Motu wants to learn Cricket from a coach, but firstly coach wants to test his IQ level, so he gave Motu $1$ $Red$ $ball$ and $1$ $Black$ $ball$ , and asked him to buy other $x – 1$ red balls and other $y – 1$ black balls from the market. But he put some conditions on buying balls, that if he has $R$ red and $B$ black balls then he can either buy $B$ red balls or $R$ black balls in one operation. He can perform this operation as many times as he want. But as Motu is not so good in solving problems so he needs your help. So you have to tell him whether his coach’s task possible or not.

-----Input:-----
- First line will contain $T$, number of testcases. Then the testcases follow. 
- Each testcase contains of a single line of input, two integers $x , y$. 

-----Output:-----
For each testcase, print $YES$, if it is possible to complete coach task, else print $NO$(without quotes) in a separate line.

-----Constraints-----
- $1 \leq T \leq 100000$
- $1 \leq x, y \leq$ 10^18

-----Sample Input:-----
2
1 2
2 3

-----Sample Output:-----
YES
YES

Source: codechef | Difficulty: UNKNOWN_DIFFICULTY


Solutions:
T = int(input())
while T:
	(x, y) = map(int, input().split())
	while y:
		(x, y) = (y, x % y)
	if x == 1:
		print('YES')
	else:
		print('NO')
	T -= 1


import math
T = int(input())
while T:
	(a, b) = map(int, input().split())
	if math.gcd(a, b) == 1:
		print('YES')
	else:
		print('NO')
	T -= 1


import math
t = int(input())
for _ in range(t):
	(a, b) = list(map(int, input().split()))
	if math.gcd(a, b) == 1:
		print('YES')
	else:
		print('NO')


for t in range(int(input())):
	(R, B) = [int(i) for i in input().split(' ')]
	while R > 1 and B > 1:
		if R > B:
			R = R - B * int(R / B)
		elif R < B:
			B = B - R * int(B / R)
		else:
			break
	if R == 1 or B == 1:
		print('YES')
	else:
		print('NO')


import math
for _ in range(int(input())):
	(x, y) = map(int, input().split())
	if math.gcd(x, y) == 1:
		print('YES')
		continue
	print('NO')


def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def sol(x, y):
	return 'YES' if gcd(x, y) == 1 else 'NO'

def main():
	T = int(input())
	for i in range(T):
		(x, y) = list(map(int, input().split()))
		print(sol(x, y))

def __starting_point():
	main()
__starting_point()


from math import gcd
for _ in range(int(input())):
	(x, y) = list(map(int, input().split()))
	if gcd(x, y) > 1:
		print('NO')
	else:
		print('YES')


from fractions import gcd
t = int(input())
while t:
	(x, y) = [int(i) for i in input().split(' ')]
	if gcd(x, y) == 1:
		print('YES')
	else:
		print('NO')
	t -= 1


def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)
testcases = int(input())
while testcases:
	testcases -= 1
	(x, y) = map(int, input().split())
	if gcd(x, y) == 1:
		print('YES')
	else:
		print('NO')


def rec(x, y):
	if x == 1 or y == 1:
		return True
	if x == 0 or y == 0:
		return False
	l = max(x, y)
	m = min(x, y)
	return rec(l % m, m)
t = int(input())
for _ in range(t):
	(a, b) = (int(x) for x in input().split())
	if rec(a, b):
		print('YES')
	else:
		print('NO')


def gcd(a, b):
	while b != 0:
		(a, b) = (b, a % b)
	return a
for test in range(int(input())):
	a = [int(s) for s in input().split()]
	if gcd(a[0], a[1]) == 1:
		print('YES')
	else:
		print('NO')


ipnl = lambda n: [int(input()) for _ in range(n)]
inp = lambda : int(input())
ip = lambda : [int(w) for w in input().split()]
mp = lambda : map(int, input().split())
import math
for _ in range(int(input())):
	(x, y) = mp()
	if math.gcd(x, y) == 1:
		print('YES')
	else:
		print('NO')


ipnl = lambda n: [int(input()) for _ in range(n)]
inp = lambda : int(input())
ip = lambda : [int(w) for w in input().split()]
mp = lambda : map(int, input().split())
import math

def per(x):
	s = int(math.sqrt(x))
	return s * s == x

def isfibo(n):
	return per(5 * n * n + 4) or per(5 * n * n - 4)
for _ in range(int(input())):
	(x, y) = mp()
	if math.gcd(x, y) == 1:
		print('YES')
	else:
		print('NO')


def hcf(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def __starting_point():
	for _ in range(int(input())):
		(x, y) = list(map(int, input().split()))
		if hcf(x, y) == 1:
			print('YES')
		else:
			print('NO')
__starting_point()


t = int(input())

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)
while t > 0:
	x = input().split()
	a = int(x[0])
	b = int(x[1])
	if gcd(a, b) == 1:
		print('YES')
	else:
		print('NO')
	t -= 1


for _ in range(int(input())):
	(a, b) = list(map(int, input().split()))
	flag = 0
	while 1:
		if a == b and a != 1:
			print('NO')
			flag = 1
			break
		elif a == 1 or b == 1:
			print('YES')
			flag = 1
			break
		elif a > b and a % b == 0:
			print('NO')
			flag = 1
			break
		elif b > a and b % a == 0:
			print('NO')
			flag = 1
			break
		if a > b:
			(a, b) = (a % b, b)
		else:
			(a, b) = (a, b % a)


import math
for _ in range(int(input())):
	(x, y) = list(map(int, input().split()))
	r = 1
	b = 1
	temp = math.gcd(x, y)
	if temp == 1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	Flag = False
	while x >= 1 and y >= 1:
		if x == 1 or y == 1:
			Flag = True
			break
		elif x == y and x != 1:
			break
		elif x > y:
			x = x - x // y * y
		else:
			y = y - y // x * x
	if Flag:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(x, y) = list(map(int, input().split()))
	a = max(x, y)
	b = min(x, y)
	while a % b != 0:
		a = a % b
		p = a
		q = b
		a = max(p, q)
		b = min(p, q)
	if a == 1 or b == 1:
		print('YES')
	else:
		print('NO')


def main():
	for _ in range(int(input())):
		(a, b) = list(map(int, input().split()))
		while not (a == 1 and b == 1):
			if a == b or a == 0 or b == 0:
				break
			if a == max(a, b):
				a = a % b
			else:
				b = b % a
		if a == 1 and b == 0 or (a == 0 and b == 1):
			print('YES')
		else:
			print('NO')
main()


t = int(input())
for c in range(t):
	(x, y) = list(map(int, input().split()))
	f = 0
	while x != 1 and y != 1 and (f == 0):
		if y > x and y % x == 0:
			f = 1
		elif y > x:
			y = y % x
		elif x > y and x % y == 0:
			f = 1
		elif x > y:
			x = x % y
		elif x == y and x != 1:
			f = 1
	if f == 0:
		print('YES')
	else:
		print('NO')


import math
for i in range(int(input().strip())):
	(a, b) = [int(i) for i in input().strip().split(' ')]
	if math.gcd(a, b) == 1:
		print('YES')
	else:
		print('NO')