Problem E: Three Body[Medium]

Problem E: Three Body[Medium]

Time Limit: 1 Sec  Memory Limit: 128 MB
Submit: 488  Solved: 227
[Submit][Status][Web Board]


Three body is a very popular book among teenagers. It tells us some planets are far away from us, but they can destroy the earth easily. We assume all planets are arranged in a circle. One day, the most powerful planet is about to destroy other planets.  It destroys other planets in the following way:

All planets are numbered 0,1, 2, . . ., n-1. The destruction starts from the planet numbered 0 in the first round. Every round the planet numbered (m + 1)th (we define m to be the destroy number) planet is going to be destroyed. After that, the planet right after it becomes the first planet in the next time. The most powerful planet consecutively attack other planets until all other planets are destroyed.

Now, give you the index of the earth, please determine whether the earth is the last planet to be destroyed.


First line includes a positive integer T (T<=100) representing the number of test cases.

For each test case, the line includes n and m and e, indicating the number of planets, the destroy number, and the index of earth, respectively.

(1 <= n, m <= 100, 0 <= e < n)


For each test case, if the earth is the last to be destroyed, output a line containing “Yes”, otherwise output a line containing “No”.

Sample Input

3 4 0
3 4 1
3 3 1

Sample Output