Codeforces Round 870 (Div. 2)
C
Dreaming of Freedom
Codeforces
1300
原题
← BD →
翻译中…

Because to take away a man's freedom of choice, even his freedom to make the wrong choice, is to manipulate him as though he were a puppet and not a person.— Madeleine L'Engle

翻译中…

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?

翻译中…

Input

翻译中…

The first line contains a single integer $t$ ($1 \leq t \leq 10^5$) — the number of test cases.

翻译中…

Each test case consists of a single line containing two integers $n$ and $m$ ($1 \leq n, m \leq 10^6$) — the number of people and choice options respectively.

翻译中…

Output

翻译中…

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, YES, Yes, yes, yEs will all be recognized as a positive answer).

翻译中…

Note

翻译中…

In the first example, there are $8$ 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\}$.

翻译中…

In cases $1$, $2$, $3$, and $5$, 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|2$. Both algorithms have the maximum number of votes and remain for the next round, so the voting never ends.

翻译中…

样例

Input #1
5
3 2
4 2
5 3
1000000 1000000
1 1000000
Output #1
YES
NO
YES
NO
YES
InputCopy OutputCopy
题目信息
题号
1826C
时间限制
2.5 s
内存限制
256 MB
标签
贪心
数学
数论

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。