import sys
import math
input = sys.stdin.readline

def check_permutations(n, a, b):
    return sorted(n) == sorted(a + b)


res = []
i = int(input())
for i in range(i):
    flag = True
    n, a, b = map(int, input().split())
    n_s, a_s, b_s = str(n), str(a), str(b)

    if n != a * b:
        flag = False
    elif not (len(a_s) == len(b_s) and len(a_s) + len(b_s) == len(n_s)):
        flag = False
    elif a % 10 == 0 and b % 10 == 0:
        flag = False
    elif not check_permutations(n_s, a_s, b_s):
        flag = False

    res.append(flag)

for r in res:
    if r: print("YES")
    else: print("NO")


