import sys from itertools import permutations count = int(sys.stdin.readline()) groups = [] for i in range(count): args = [int(arg) for arg in sys.stdin.readline().split()] n = max(args) rest = [i for i in args if i != n] groups.append((n, rest[0], rest[1])) def is_perm(n, a, b): for start in permutations(a, len(a)): for end in permutations(b, len(b)): s = "" for char in start: s += str(char) for char in end: s += str(char) if s == n: return True return False for perm in permutations(["a", "b"], 3): print(perm) for bats in groups: n = bats[0] a = bats[1] b = bats[2] if a * b != n: sys.stdout.write("NO" + "\n") continue l = len(str(n)) half = l / 2 if l % 2 != 0: sys.stdout.write("NO" + "\n") continue if len(str(a)) != half or len(str(b)) != half: sys.stdout.write("NO" + "\n") continue if a % 10 == 0 and b % 10 == 0: sys.stdout.write("NO" + "\n") continue if not is_perm(str(n), str(a), str(b)): sys.stdout.write("NO" + "\n") continue sys.stdout.write("YES" + "\n")