import sys
import math
input = sys.stdin.readline

def check_permutations(arr, string):
    arr.remove(string)
    for item in arr:
        for ch in item:
            if ch in string:
                string = string.replace(ch, "")
            else: return False
    if not string: return True
    return False


res = []
i = int(input())
for i in range(i):
    flag = True
    arr = list(map(int, input().split()))
    arr_s = [str(x) for x in arr]
    maxval = max(arr)
    max_str = max(arr_s, key=lambda x: len(x))
    if maxval != arr[0]:
        flag = False
    elif not (arr[0] * arr[1] == arr[2] or arr[0] * arr[2] == arr[1] or arr[1] * arr[2] == arr[0]):
        flag = False
    elif len(max_str) % 2 != 0:
        flag = False
    elif not ((len(max_str) / 2 == len(arr_s[0]) or len(max_str) == len(arr_s[0])) and (len(max_str) / 2 == len(arr_s[1]) or len(max_str) == len(arr_s[1])) and (len(max_str) / 2 == len(arr_s[2]) or len(max_str) == len(arr_s[2]))):
        flag = False
    elif arr[0] % 10 == 0 and arr[1] % 10 == 0 and arr[2] % 10 == 0:
        flag = False
    elif not check_permutations(arr_s, max_str):
        flag = False

    res.append(flag)

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


