from collections import Counter


def perm(n,a,b):
    c = "".join([a,b])
    c1 = Counter(c)
    c2 = Counter(n)
    if(c1 == c2):
        return True
    else:
        return False

def main():
    t = int(input())
    for _ in range(t):
        n, a, b = input().split()
        if(len(a) == len(b) and len(n) == 2 * len(b) and (int(a) % 10 != 0 or int(b) % 10 != 0) and int(a) * int(b) == int(n)):
            if(perm(n,a,b)):
                print("YES")
                 
            else:
                print("NO")
                 
        else:
            print("NO")
main()