J. Jolly Polygon
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

You are given two integers $$$n$$$ and $$$2s$$$. Please note that the second integer is denoted by $$$s$$$ multiplied by $$$2$$$, although it can still be either even or odd.

In the rectangular coordinate system $$$Oxy$$$, find any polygon with $$$n$$$ sides and $$$n$$$ vertices such that:

  • the $$$i$$$-th vertex has integer coordinates $$$(x_i, y_i)$$$, where $$$0 \le x_i, y_i \le 10^6$$$;
  • its area is equal to $$$s$$$ (note: depending on whether $$$2s$$$ is even or odd, either $$$s$$$ or $$$s + \frac{1}{2}$$$ is an integer);
  • its boundary does not touch or cross itself;
  • no two vertices of the polygon coincide;
  • no three consecutive vertices of the polygon lie on the same line.

If there are no such polygons, report this.

Input

Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 20\,000$$$). The description of the test cases follows.

The only line of each test case contains two integers $$$n$$$ and $$$2s$$$ ($$$3 \le n \le 1000$$$, $$$1 \le 2s \le 10^6$$$): the number of vertices and the double area of a desired polygon.

It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$60\,000$$$.

Output

For each test case, if a desired polygon does not exist, print the single word "NO" (without quotes).

Otherwise, in the first line, print the word "YES" (without quotes). In the $$$i$$$-th of the next $$$n$$$ lines, print two integers $$$x_i$$$ and $$$y_i$$$: the coordinates of the $$$i$$$-th vertex of a polygon that meets all the requirements. The vertices must be listed either clockwise or counterclockwise.

If there are multiple solutions, print any of them.

You may output the words in any case (upper or lower). For example, the strings "yEs", "yes", "Yes", and "YES" will be recognized as positive responses.

Example
Input
2
9 4
6 23
Output
NO
YES
1 1
2 2
2 3
1 4
5 4
6 1
Note

In the first test case, we can show there are no $$$9$$$-gons with an area of $$$\frac{4}{2} = 2$$$ that meet all the requirements.

In the second test case, we have a desired $$$6$$$-gon with an area of $$$\frac{23}{2}$$$. Note that polygons may be non-convex.