Arcane Numbers 1
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1687 Accepted Submission(s): 528

Problem Description
Vance and Shackler like playing games. One day, they are playing a game called “arcane numbers”. The game is pretty simple, Vance writes down a finite decimal under base A, and then Shackler translates it under base B. If Shackler can translate it into a finite decimal, he wins, else it will be Vances win. Now given A and B, please help Vance to determine whether he will win or not. Note that they are playing this game using a mystery language so that A and B may be up to 10^12.

Input
The first line contains a single integer T, the number of test cases.
For each case, theres a single line contains A and B.

Output
For each case, output NO if Vance will win the game. Otherwise, print YES. See Sample Output for more details.

Sample Input
3
5 5
2 3
1000 2000

Sample Output
Case #1: YES
Case #2: NO
Case #3: YES

Author
Vance and Shackler

Source
2012 Multi-University Training Contest 3

Recommend
zhoujiaqi2010

nnkk1
abab

 ```1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 ``` ```#include #include #include #include #include   using namespace std;   int const maxm=1009999; int prime[maxm]; long long pri[maxm]; int sum; void sievePrime(){ // int j; int i; for(i=0;i