import sys,os,io input = sys.stdin.readline #input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline T = int(input()) ans = ['NO']*T def extgcd(a, b): # ax + by = d if b==0: return a, 1, 0 # a・1 + b・0 = a (b = 0のとき) d, y, x = extgcd(b, a%b) y -= (a//b)*x return d, x, y from math import gcd for t in range(T): N, A, B = map(int, input().split()) if gcd(A,B)==1: _, x, y = extgcd(A, B) m = max(abs(x*A), abs(y*B)) if N >= m+1: ans[t] = 'YES' print(*ans, sep='\n')