n = int(input()) for nn in range(n): sample = input().split() sample = [int(s) for s in sample] ratio = sample[2] / sample[1] total = 1 stuff = True for s in sample: if s == 1: continue else: total *= ratio if total != s: print('no') stuff = False break if stuff: print('yes', int(ratio))