from functools import cmp_to_key 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))]) if len(points) < K : print("No") else: print("Yes") def cmp(a, b): return (a[0] ** 2 + a[1] ** 2) < (b[0] ** 2 + b[1] ** 2) points.sort(key=cmp_to_key(cmp)) print(*points[K - 1])