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:-----
12
21
123
231
312
1234
2341
3412
4123

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

Difficulty: interview

Starter code:

Solutions:
# cook your dish here
for a0 in range(int(input())):
    n = int(input())
    l = []
    for i in range(1,n+1):
        l.append(i)
    
    for j in range(n):
        s = ""
        for k in l:
            s+=str(k)
        print(s)
        x = l[0]
        l.pop(0)
        l.append(x)


for _ in range(int(input())):
    n = int(input())
    arr = list(range(1,n+1))
    for i in range(n):
        print(*(arr[i:]+arr[:i]),sep='')

from sys import*
input=stdin.readline
t=int(input())
for _ in range(t):
    n=int(input())
    y=1
    for i in range(n):
        y=i+1
        for j in range(n):
            print(y,end="")
            y=(y+1)
            if y>n:
                y=y%n
            if y==0:
                y=1
        print()


for _ in range(int(input())):
    n = int(input())
    if n == 1:
        print(n)
        continue
    s = []
    for i in range(1, n + 1):
        s.append(i)
    s*=2
    # print(s)
    for i in range(0, len(s)//2):
        x = s[i:i+n]
        x = list(map(str, x))
        print(''.join(x))
        # print(s[i:i+n])



t=int(input())
while t>0:
    t-=1
    n=int(input())
    a=[]
    for i in range(1,n+1):
        a.append(i)
    for i in range(n):
        
        for i in a:
            print(i,end="")
        x=a[0]
        a.append(x)
        a.pop(0)
        print()



t=int(input())
for i in range(t):
    k=int(input())
    arr=[]
    for i in range(1,k+1):
        arr.append(i)
    
    for i in range(k):
        for j in range(i,k):
            print(arr[j],end="")
        for j in range(0,i):
            print(arr[j],end="")
        print()    


for _ in range(int(input())):
    n = int(input())
    l = list(range(1, n + 1))
    for x in range(n):
        print(*l[x:], sep="", end="")
        print(*l[:x], sep="")
# cook your dish here


for _ in range(int(input())):
    n=int(input())
    a=[]
    for _ in range(1,n+1):
            a.append(str(_))
    a=a+a
    for _ in range(n):
        print(''.join(a[_:_+n]))


t=int(input())
for i in range(t):
    k=int(input())
    m=0
    for j in range(1,k+1):
        for m in range(j,k+1):
            print(m,end="")
        for n in range(1,j):
            print(n,end="")
        print()

try:
    t = int(input())
    for a in range(t):
        k = int(input())
        lst = []
        for i in range(1,k+1):
            lst.append(str(i))
        print("".join(lst))
        for i in range(k-1):
            lst.append(lst[0])
            lst.pop(0)
            print("".join(lst))
except EOFError:
    pass

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

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


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(1, n+1):
        for j in range(n):
            a = (i+j)%n if (i+j)%n!=0 else n
            print(str(a), end="")
        print()

for _ in range(int(input())):
    n = int(input())
    l = list(range(1, n+1))

    for i in range(n):
        print(*l, sep='')
        l = l[1:] + [l[0]]


for tc in range(int(input())):
    K = int(input())
    S = [str(i) for i in range(1, K + 1)]
    for i in range(K):
        print(''.join(S))
        S = S[1:] + [S[0]]