The chef is trying to solve some pattern problems, Chef wants your help to code it. Chef has one number K to form a new pattern. Help the chef to code this pattern problem.

-----Input:-----
- First-line will contain $T$, the number of test cases. Then the test cases follow. 
- Each test case contains a single line of input, one integer $K$. 

-----Output:-----
For each test case, output as the pattern.

-----Constraints-----
- $1 \leq T \leq 100$
- $1 \leq K \leq 100$

-----Sample Input:-----
3
2
3
4

-----Sample Output:-----
21
1
123
21
1
4321
123
21
1

-----EXPLANATION:-----
No need, else pattern can be decode easily.

Difficulty: interview

Starter code:

Solutions:
for _ in range(int(input())):
 n = int(input())
 s = ''
 for i in range(1, n + 1): s += str(i)
 for i in range(n, 0, -1):
  if i % 2 == 0:
   for j in range(i, 0, -1): print(j, end = '')
  else:
   for j in range(1, i + 1): print(j, end = '')
  print()




# cook your dish here
for _ in range(int(input())):
 n=int(input())
 for i in range(n,0,-1):
  if i%2==0:
   for j in range(n,0,-1):
    print(j,end="")
   n-=1
   print("")
  else:
   for j in range(1,n+1):
    print(j,end="")
   n-=1
   print("")



# cook your dish here
n=int(input())
a=[]
for _ in range(n):
 a.append(int(input()))
for i in a:
 for j in range(i,0,-1):
  if j%2==0:
   for k in range(j,0,-1):
    print(k,end="")
   print()
  else:
   for k in range(1,j+1):
    print(k,end="")
   print()

t = int(input())
for _ in range(t):
 n = int(input())
 if n%2==0:
  for i in range(n):
   for j in range(n):
    if i%2==0:
     if i+j <= (n-1):
      print(n-i-j,end='')
    else:
     if i+j <= (n-1):
      print(j+1,end='')
   print()
 else:
  for i in range(n):
   for j in range(n):
    if i%2==0:
     if i+j <= (n-1):
      print(j+1,end='')
    else:
     if i+j <= (n-1):
      print(n-i-j,end='')
   print()
     


t=int(input())
for i in range(t):
 k=int(input())
 for j in range(k,0,-1):
   if j%2==0:
    for m in range(j,0,-1):
     print(m,end="")
   else:
    for m in range(1,j+1):
     print(m,end="")
   print()

t=int(input())
for _ in range(t):
 n=int(input())
 if n%2:
  m=1
 else:
  m=0
 for i in range(n):
  if (i+m)%2:
   for j in range(n-i):
    print(j+1,end="")
   print()
  else:
   x=n-i
   while(x>0):
    print(x,end="")
    x-=1
   print()
  
 
  
 
    
 


n=int(input())
for i in range(n):
 a=int(input())
 for j in range(a,0,-1):
  if(j%2==0):
   k=j
   while(k>0):
    print(k,end="")
    k=k-1
   print()
  else:
   k=1
   while(k<=j):
    print(k,end="")
    k=k+1
   print()# cook your dish here


n=int(input())
for i in range(n):
 a=int(input())
 for j in range(a,0,-1):
  if(j%2==0):
   k=j
   while(k>0):
    print(k,end="")
    k=k-1
   print()
  else:
   k=1
   while(k<=j):
    print(k,end="")
    k=k+1
   print()# cook your dish here


#Pattern F
T = int(input())

for t in range(T):
 N = int(input())
 
 for i in range(N):
  sol = ""
  if((i+N)%2==0):
   for j in range(N-i,0,-1):
    sol+=str(j)
   print(sol)
  else:
   for j in range(1,N-i+1):
    sol+=str(j)
   print(sol)

for tc in range(int(input())):
 K = int(input())
 A = []
 for i in range(K):
  ar = [str(_ + 1) for _ in range(i + 1)]
  if i % 2: ar = ar[::-1]
  A.append(ar)
 A = A[::-1]
 for row in A: print(''.join(row))

from sys import stdin, stdout
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque
from heapq import merge, heapify, heappop, heappush, nsmallest
from bisect import bisect_left as bl, bisect_right as br, bisect
mod = pow(10, 9) + 7
mod2 = 998244353
def inp(): return stdin.readline().strip()
def out(var, end="\n"): stdout.write(str(var)+"\n")
def outa(*var, end="\n"): stdout.write(' '.join(map(str, var)) + end)
def lmp(): return list(mp())
def mp(): return map(int, inp().split())
def smp(): return map(str, inp().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]
def remadd(x, y): return 1 if x%y else 0
def ceil(a,b): return (a+b-1)//b

def isprime(x):
 if x<=1: return False
 if x in (2, 3): return True
 if x%2 == 0: return False
 for i in range(3, int(sqrt(x))+1, 2):
  if x%i == 0: return False
 return True

for _ in range(int(inp())):
 n = int(inp())
 for i in range(n, 0, -1):
  if i%2:
   print("".join(map(str, range(1, i+1))))
  else: 
   print("".join(map(str, range(1, i+1)[::-1])))

for _ in range(int(input())):
 n = int(input())
 l = list(range(1, n+1))

 while l:
  if len(l) % 2 == 0:
   print(*l[::-1], sep='')
  else:
   print(*l, sep='')

  l.pop()