t = int(input())

for _ in range(t):
    n, a, b = map(int,input().split())
    if a%10 == 0 and b%10 == 0:
        print("NO")
        continue
    k = len(str(n))//2
    if len(str(a)) != k or len(str(b)) != k:
        print("NO")
        continue
    if n != a*b:
        print("NO")
        continue
    if sorted(str(a)+str(b)) != sorted(str(n)):
        print("NO")
        continue
    print("YES")