
t = int(input())
for i in range(t):
    n, a, b = map(int, input().split())

    if (len(str(a)) == len(str(b))) and (a * b == n) and (a % 10 != 0 or b % 10 != 0) and (list(sorted(str(a) + str(b))) == list(sorted(str(n)))):
        print("YES")
    else:
        print("NO")