import sys,os,io input = sys.stdin.readline #input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline T = int(input()) ans = [0]*T from math import gcd for t in range(T): N, A, B = map(int, input().split()) ans[t] = 'YES' if gcd(A,B)==1 else 'NO' print(*ans, sep='\n')