T = int(input()) def gcd(a,b): while True: r = a % b a = b b = r if r == 0: return a for _ in range(T): n,a,b = map(int,input().split()) d = gcd(a,b) print('Yes' if d == 1 else 'No')