D. Mr.Wow and Multiset
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Mr. Wow has a multiset $$$S$$$ of size $$$n$$$. At first, $$$S = \{1,2,\ldots,n\}$$$.

Mr. Wow can do the following operation exactly $$$(n-1)$$$ times:

  • Choose two elements $$$x, y$$$ in $$$S$$$(the value of $$$x$$$ and $$$y$$$ may be equal), remove them from $$$S$$$, then insert $$$(x-y)$$$ in $$$S$$$.

Determine if it's possible to make $$$S = \{m\}$$$ after $$$(n-1)$$$ operations. If it is possible, output any scheme.

Input

The first line contains an integer $$$t$$$ $$$(1 \leq t \leq 10^5)$$$, the number of test cases.

For each test case, there is a single line containing two integers $$$n$$$ and $$$m$$$ $$$(2 \leq n \leq 2 \cdot 10^5,-\frac{n(n+1)}{2} \leq m \leq \frac{n(n+1)}{2})$$$.

It's guaranteed that the sum of $$$n$$$ over all test cases will not exceed $$$2 \cdot 10^5$$$.

Output

For each test case:

  • If it's possible to make $$$S = \{m\}$$$ after the $$$(n-1)$$$ operations, print "YES" on a new line. Otherwise, print "NO" on a new line.
  • If "YES" is printed, on the next $$$(n-1)$$$ lines, print two integers $$$x_i, y_i$$$ in each line, representing the pairs of elements chosen in the $$$i$$$-th operation. In other words, in the $$$i$$$-th operation, you choose two elements $$$x_i$$$ and $$$y_i$$$ which are already in $$$S$$$, remove them from $$$S$$$, then insert $$$(x_i-y_i)$$$ in $$$S$$$.
Example
Input
5
3 0
3 1
4 6
4 10
5 -11
Output
YES
3 2
1 1
NO
YES
2 3
-1 4
1 -5
NO
YES
2 3
-1 4
-5 5
-10 1
Note

For the $$$1$$$-st test case, $$$S=\{1,2,3\}$$$ initially.

You can make $$$S = \{0\}$$$ using the following scheme:

  • In the first operation, you choose $$$x_1=3$$$ and $$$y_1=2$$$ in $$$S$$$, remove them from $$$S$$$, then insert $$$(x_1-y_1)=3-2=1$$$ in $$$S$$$. Currently $$$S=\{1,1\}$$$;
  • In the second operation, you choose $$$x_2=1$$$ and $$$y_2=1$$$ in $$$S$$$, remove them from $$$S$$$, then insert $$$(x_2-y_2)=1-1=0$$$ in $$$S$$$. Currently $$$S=\{0\}$$$.

For the $$$2$$$-nd test case, you can not make $$$S = \{1\}$$$.