Problem: Problem :

Bajirao asks Avni out on a date. However, Avni will go out with him only on one condition : 

Bajirao has to tell her all possible N - digit numbers such that all the digits of every number he tells her are distinct , non-zero and   less than or equal to N. 

Also, he has to tell her all these numbers in ascending order. Help Bajirao so that he can take Avni out on a date.

Input

First line consists of T the number of test cases. The next T lines are such that each line consists of a single integer N.

Output

For every test case, print all the numbers Bajirao tells Avni, such that the numbers are in ascending order and every number is separated from the other by a single space. Print the answer to every test case on a new line.

Constraints :

1 ≤ T ≤ 3

1 ≤ N ≤ 9

Problem Setter : Shreyans

Problem Tester : Sandeep

(By IIT Kgp HackerEarth Programming Club)

SAMPLE INPUT
3
1
2
3

SAMPLE OUTPUT
1
12 21
123 132 213 231 312 321

Solution (in PYTHON):

Solution:
import sys
from itertools import permutations
T=input()
for cs in xrange(T):
	n=input()
	if(n==1):
		print"1"
	if(n==2):
		print"12 21"
	if(n==3):
		ss=set()
		ss = ["".join(a) for a in permutations(["1", "2", "3"], n)]
		ss.sort()
		for b in ss:
			sys.stdout.write(b+" ")
		print""
	if(n==4):
		ss=set()
		ss = ["".join(a) for a in permutations(["1", "2", "3","4"], n)]
		ss.sort()
		for b in ss:
			sys.stdout.write(b+" ")
		print""
	if(n==5):
		ss=set()
		ss = ["".join(a) for a in permutations(["1", "2", "3","4","5"], n)]
		for b in ss:
			sys.stdout.write(b+" ")
		print""
	if(n==6):
		ss=set()
		ss = ["".join(a) for a in permutations(["1", "2", "3","4","5","6"], n)]
		ss.sort()
		for b in ss:
			sys.stdout.write(b+" ")
		print""
	if(n==7):
		ss=set()
		ss = ["".join(a) for a in permutations(["1", "2", "3","4","5","6","7"], n)]
		ss.sort()
		for b in ss:
			sys.stdout.write(b+" ")
		print""
	if(n==8):
		ss=set()
		ss = ["".join(a) for a in permutations(["1", "2", "3","4","5","6","7","8"], n)]
		ss.sort()
		for b in ss:
			sys.stdout.write(b+" ")
		print""
	if(n==9):
		ss=set()
		ss = ["".join(a) for a in permutations(["1", "2", "3","4","5","6","7","8","9"], n)]
		ss.sort()
		for b in ss:
			sys.stdout.write(b+" ")
		print""