Description
This problem is a programming version of Problem 24 from projecteuler.net
A permutation is an ordered arrangement of objects. For example, dabc is one possible permutation of the word abcd. If all of the permutations are listed alphabetically, we call it lexicographic order. The lexicographic permutations of abc are:
abc acb bac bca cab cba
What is the Nth lexicographic permutation of the word abcdefghijklm?
Input Format
The first line contains an integer T , i.e., number of test cases.
Next T lines will contain an integer N.
Output Format
Print the values corresponding to each test case.
Constraints
1 ≤ T ≤ 1000 1 ≤ N ≤ 13!
Sample Input
Sample Output




Reviews
There are no reviews yet.