for _ in range(int(input())): d, k = map(int, input().split()) j = d // 2 i = d - j c = 0 found = False while i <= d: if i == j == 0: c += 1 elif i == j or i == d: c += 4 else: c += 8 if c >= k: print('Yes') print(i, j) found = True break i += 1 j -= 1 if not found: print('No')