t = int(input())



def check(n, a, b):
    if n != a * b:
        return False
    if not (len(str(a)) == len(str(b)) and (len(str(b) + str(a)) == len(str(n)))):
        return False
    if a % 10 == 0 and b % 10 == 0:
        return False
    if len(set(str(n))) != len(set(str(a) + str(b))):
        return False
    return True

for i in range(t):
    n, a, b = map(int, input().split())
    print("YES" if check(n, a, b) else "NO")