#P986F. Oppa Funcan Style Remastered

    ID: 3386 Type: RemoteJudge 5000ms 256MiB Tried: 0 Accepted: 0 Difficulty: (None) Uploaded By: Tags>graphsmathnumber theoryshortest paths*3300

Oppa Funcan Style Remastered

No submission language available for this problem.

Description

Surely you have seen insane videos by South Korean rapper PSY, such as "Gangnam Style", "Gentleman" and "Daddy". You might also hear that PSY has been recording video "Oppa Funcan Style" two years ago (unfortunately we couldn't find it on the internet). We will remind you what this hit looked like (you can find original description here):

On the ground there are nn platforms, which are numbered with integers from 11 to nn, on ii-th platform there is a dancer with number ii. Further, every second all the dancers standing on the platform with number ii jump to the platform with the number f(i)f(i). The moving rule ff is selected in advance and is not changed throughout the clip.

The duration of the clip was kk seconds and the rule ff was chosen in such a way that after kk seconds all dancers were in their initial positions (i.e. the ii-th dancer stood on the platform with the number ii). That allowed to loop the clip and collect even more likes.

PSY knows that enhanced versions of old artworks become more and more popular every day. So he decided to release a remastered-version of his video.

In his case "enhanced version" means even more insanity, so the number of platforms can be up to 101810^{18}! But the video director said that if some dancer stays on the same platform all the time, then the viewer will get bored and will turn off the video immediately. Therefore, for all xx from 11 to nn f(x)xf(x) \neq x must hold.

Big part of classic video's success was in that looping, so in the remastered version all dancers should return to their initial positions in the end of the clip as well.

PSY hasn't decided on the exact number of platforms and video duration yet, so he asks you to check if there is a good rule ff for different options.

In the first line of input there is one integer tt (1t1041 \le t \le 10^{4}) — the number of options for nn and kk to check.

In the next tt lines the options are given: each option is described with two integers nn and kk (1n10181 \le n \le 10^{18}, 1k10151 \le k \le 10^{15}) — the number of dancers and the duration in seconds.

It is guaranteed that the number of different values of kk in one test is not greater than 5050.

Print tt lines. If the ii-th option of the video is feasible, print "YES" (without quotes) in ii-th line, otherwise print "NO" (without quotes).

Input

In the first line of input there is one integer tt (1t1041 \le t \le 10^{4}) — the number of options for nn and kk to check.

In the next tt lines the options are given: each option is described with two integers nn and kk (1n10181 \le n \le 10^{18}, 1k10151 \le k \le 10^{15}) — the number of dancers and the duration in seconds.

It is guaranteed that the number of different values of kk in one test is not greater than 5050.

Output

Print tt lines. If the ii-th option of the video is feasible, print "YES" (without quotes) in ii-th line, otherwise print "NO" (without quotes).

Samples

Sample Input 1

3
7 7
3 8
5 6

Sample Output 1

YES
NO
YES