I found an interesting problem on https://www.codechef.com/PTRN2020/problems/ITGUY39:
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.

I tried it in Python, but could not do it. Can you solve it?
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()