t = int(input())
ok = True
def is_perm(ab, n):
    if len(ab) != len(n): return False
    used = set()
    for d in ab:
        for i in range(len(n)):
            if i in used: continue
            if d == n[i]:
                used.add(i)
                break
    return len(used) == len(ab)

for _ in range(t):
    ok = True
    n,a,b  = map(int, input().split())
    ok = ok and n == a*b
    ok = ok and len(str(a)) == len(str(b))
    ok = ok and (a % 10 == 0 or b % 10 == 0)
    ok = ok and is_perm(str(a)+str(b), str(n))
    print("YES" if ok else "NO")
