#nt302. 中国剩余定理2
中国剩余定理2
Chinese Remainder Theorem 2
Problem Description
There are test cases. Each case gives equations of the form . Determine whether the system of equations has a solution.
Input Format
The first line contains one integer .
For each test case, the first line contains one integer , and the next lines each contain two integers .
Output Format
For each test case, output one string Yes or No indicating whether a solution exists.
Sample Input
2
3
1 10
2 11
3 12
3
2 10
2 11
3 12
Sample Output
Yes
No
Constraints
It is guaranteed that , , and .