Problem7317--CodeChef MAKEMULTIPLE - Make Multiple

7317: CodeChef MAKEMULTIPLE - Make Multiple

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 256 MiB

Description

Chef has two integers A and B (A≤B).
Chef can choose any non-negative integer X and add them to both A and B. 
Find whether it is possible to make A a divisor of B.

Input

The first line of input will contain a single integer T, denoting the number of test cases.
Each test case consists of two integers A and B.

Output

For each test case, output YES if it is possible to make A a factor of B, NO otherwise.

Constraints

$1≤T≤10^5$
$1 \leq A \leq B \leq 10^9$

Sample 1 Input

3
3 6
4 14
9 10

Sample 1 Output

YES
YES
NO
Test case 1: We can choose X = 0 and add them to 3 and 6. Thus, 3 is a factor of 6.
Test case 2: We can choose X = 1 and add them to 4 and 14. Thus, 4+1 = 5 is a factor of 14+1 = 15.
Test case 3: There is no possible value of X to add such that A becomes a factor of B.

HINT

难度系数:1163
题目来源:CodeChef MAKEMULTIPLE

EDITORIAL

Source/Category