#agc061b. [agc061_b]Summation By Construction

[agc061_b]Summation By Construction

Problem Statement

There is a graph with NN vertices v1,ldots,vNv_1, \\ldots, v_N on the left, and N+1N + 1 vertices u1,ldots,uN+1u_1, \\ldots, u_{N + 1} on the right. Each vertex viv_i (1leqileqN1 \\leq i \\leq N) is connected to each vertex uju_j (1leqjleqN+11 \\leq j \\leq N + 1), that is, the graph contains N(N+1)N(N + 1) edges.

We color every edge with one of the NN colors 1,ldots,N1, \\ldots, N. A coloring is suitable if for each k=1,ldots,Nk = 1, \\ldots, N there are exactly 2k2k edges of color kk, and those edges form a simple path.

Formally, for each k=1,ldots,Nk = 1, \\ldots, N there should exist a sequence of distinct vertices w0,ldots,w2kw_0, \\ldots, w_{2k} such that all of the following is true:

  • For each i=0,ldots,2k1i = 0, \\ldots, 2k - 1, vertices wiw_i and wi+1w_{i + 1} are connected with an edge of color kk,
  • No other edges of color kk exist.

Find any suitable coloring, or determine that it doesn't exist.

For each input file, solve TT test cases.

Constraints

  • 1leqTleq1001 \\leq T \\leq 100
  • 1leqNleq1001 \\leq N \\leq 100

Input

Input is given from Standard Input in the following format:

TT case1case_1 case2case_2 vdots\\vdots caseTcase_T

Each case is in the following format:

NN

Output

For each test case, if a suitable coloring does not exist, print No. Otherwise, print a suitable coloring description in the following format:

Yes C1,1C_{1, 1} C1,2C_{1, 2} ldots\\ldots C1,N+1C_{1, N + 1} vdots\\vdots CN,1C_{N, 1} CN,2C_{N, 2} ldots\\ldots CN,N+1C_{N, N + 1}

Here, Ci,jC_{i, j} is the color of the edge between viv_i and uju_j.

If there are many suitable colorings, print any of them.


Sample Input 1

2
1
2

Sample Output 1

Yes
1 1
No