q = int(input()) for _ in range(q): d, k = map(int, input().split(" ")) if d == 0: print("Yes\n0 0" if k == 1 else "No") elif k > 4 * d: print("No") else: print("Yes") k = (k + 3) // 4 t = (d + 1) // 2 + (k + d % 2) // 2 print(t, d - t)