#P1538D. Another Problem About Dividing Numbers
Another Problem About Dividing Numbers
Description
You are given two integers and . In one turn, you can do one of the following operations:
- Take an integer ( and should be divisible by ) and replace with ;
- Take an integer ( and should be divisible by ) and replace with .
Your goal is to make equal to using exactly turns.
For example, the numbers and can be made equal in moves:
- , divide by , ;
- , divide by , ;
- , divide by , ;
- , divide by , .
For the given numbers and , determine whether it is possible to make them equal using exactly turns.
The first line contains one integer (). Then test cases follow.
Each test case is contains three integers , and ().
For each test case output:
- "Yes", if it is possible to make the numbers and equal in exactly turns;
- "No" otherwise.
The strings "Yes" and "No" can be output in any case.
Input
The first line contains one integer (). Then test cases follow.
Each test case is contains three integers , and ().
Output
For each test case output:
- "Yes", if it is possible to make the numbers and equal in exactly turns;
- "No" otherwise.
The strings "Yes" and "No" can be output in any case.