Q = int(input()) for q in range(Q): D, K = map(int, input().split()) if D == 0: if K == 1: print("Yes") print(0, 0) else: print("No") continue if D * 4 < K: print("No") continue K -= 1 if D % 2 == 0: if K <= 4: temp = 0 else: temp = ((K - 4) // 8) + 1 print("Yes") print((D // 2) + temp, (D // 2) - temp) elif D % 2 == 1: temp = K // 8 print("Yes") print(D - ((D - 1) - temp), ((D - 1) - temp))