# Dreaming of Freedom Solution Codeforces

There are n programmers choosing their favorite algorithm amongst m different choice options. Before the first round, all m options are available. In each round, every programmer makes a vote for one of the remaining algorithms. After the round, only the algorithms with the maximum number of votes remain. The voting process ends when there is only one option left. Determine whether the voting process can continue indefinitely or no matter how people vote, they will eventually choose a single option after some finite amount of rounds?

Dreaming of Freedom Solution Codeforces

The first line contains a single integer t (1t1051≤�≤105) — the number of test cases.

Each test case consists of a single line containing two integers n and m (1n,m1061≤�,�≤106) — the number of people and choice options respectively.

Dreaming of Freedom Solution Codeforces

For each test case output “YES” if the programmers will eventually choose a single option, and “NO” otherwise.

You may print each letter in any case (for example, YESYesyesyEs will all be recognized as a positive answer).

Dreaming of Freedom Solution Codeforces

In the first example, there are 88 ways people could vote: {1|1|1,1|1|2,1|2|1,1|2|2,2|1|1,2|1|2,2|2|1,2|2|2}{1|1|1,1|1|2,1|2|1,1|2|2,2|1|1,2|1|2,2|2|1,2|2|2}.

In cases 112233, and 55, the programmers are left with the first algorithm, and in the remaining cases people are left with the second one, so the voting ends in one round in any case.

In the second example, the programmers could always vote 1|1|2|21|1|2|2. Both algorithms have the maximum number of votes and remain for the next round, so the voting never ends.