Consider the following $4 \times 4$ pattern:
1  2  4  7
3  5  8 11
6  9 12 14
10 13 15 16
You are given an integer $N$. Print the $N \times N$ pattern of the same kind (containing integers $1$ through $N^2$).
-----Input-----
- The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.
- The first and only line of each test case contains a single integer $N$.
-----Output-----
For each test case, print $N$ lines; each of them should contain $N$ space-separated integers.
-----Constraints-----
- $1 \le T \le 10$
- $1 \le N \le 100$
-----Subtasks-----
Subtask #1 (100 points): Original constraints
-----Example Input-----
1
4
-----Example Output-----
1 2 4 7
3 5 8 11
6 9 12 14
10 13 15 16
-----Explanation-----
# cook your dish here
try:
 for u in range(int(input())):
  n = int(input())
  li = []
  lid = []
  a = 1
  t = 0
  l = 0
  for i in range(n*n):
   t+=1
   lid.append(i+1)
   if a == t:
    if l!=-1:
     a+=1
     t = 0
    else:
     a-=1
     t = 0
    li.append([int(k) for k in lid])
    lid.clear()
   if a==n:
    l = -1
  li2 = li.copy()
  for i in li:
   if len(li2)!=0:
    a = 0
    li3 = li2.copy()
    for j in li2:
     if a == n:
      break
     a+=1
     if len(j)!=0:
      print(j[0],end=" ")
      j.remove(j[0])
    li2.clear()
    li2 = li3.copy()
    if len(j)!=0:
     print()
    else:
     break
    li2.remove(li2[0])
  print()
except:
 pass
# cook your dish here
try:
 for u in range(int(input())):
  n = int(input())
  li = []
  lid = []
  a = 1
  t = 0
  l = 0
  for i in range(n*n):
   t+=1
   lid.append(i+1)
   if a == t:
    if l!=-1:
     a+=1
     t = 0
    else:
     a-=1
     t = 0
    li.append([int(k) for k in lid])
    lid.clear()
   if a==n:
    l = -1
  li2 = li.copy()
  for i in li:
   if len(li2)!=0:
    a = 0
    li3 = li2.copy()
    for j in li2:
     if a == n:
      break
     a+=1
     if len(j)!=0:
      print(j[0],end=" ")
      j.remove(j[0])
    li2.clear()
    li2 = li3.copy()
    if len(j)!=0:
     print()
    else:
     break
    li2.remove(li2[0])
  print()
except:
 pass