Q = int(input()) for _ in range(Q): D, K = map(int,input().split()) points = [] for i in range(-D, D + 1): points.append([i, D - abs(i)]) if abs(i) != D : points.append([i, -(D - abs(i))]) for i in range(len(points)): xi, yi = points[i] dist_i = xi ** 2 + yi ** 2 cnt = [0, 0] for j in range(len(points)): xj, yj = points[j] dist_j = xj ** 2 + yj ** 2 # if i == j : continue if dist_j < dist_i: cnt[0] += 1 if dist_j <= dist_i: cnt[1] += 1 if cnt[0] < K and cnt[1] >= K: print("Yes") print(xi, xj) break else: print("No")