Gerg’s Cake

Gerg is having a party, and he has invited his friends. p of them have arrived already, but a are running late. To occupy his guests, he tried playing some team games with them, but he found that it was impossible to divide the p guests into any number of equal-sized groups of more than one person. Luckily, he has a backup plan — a cake that he would like to share between his friends. The cake is in the shape of a square, and Gerg insists on cutting it up into equal-sized square pieces. He wants to reserve one slice for each of the a missing friends, and the rest of the slices have to be divided evenly between the p remaining guests. He does not want any cake himself. Can he do it? Input The input will consist of several test cases. Each test case will be given as a non-negative integer a and a positive integer p as specified above, on a line. Both a and p will fit into a 32-bit signed integer. The last line will contain ‘-1 -1’ and should not be processed. Output For each test case, output ‘Yes’ if the cake can be fairly divided and ‘No’ otherwise. Sample Input 13 1024 17 2 101 01 -1 -1 Sample Output Yes Yes No Yes