The chef has a number N, Cheffina challenges chef to form the largest number X from the digits of N.
-----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, $N$. 
-----Output:-----
For each test case, output in a single line answer.
-----Constraints-----
- $1 \leq T \leq 10^5$
- $1 \leq N \leq 10^6$
-----Sample Input:-----
2
2
212
-----Sample Output:-----
2
221
# cook your dish here
n=int(input())
l=[]
for i in range(n):
    a=int(input())
    l.append(a)
for i in l:
    b = list(map(int, str(i)))
    b.sort(reverse=True)
    s = [str(i) for i in b]
    r = int("".join(s))
    print(r)
# cook your dish here
n=int(input())
l=[]
for i in range(n):
    a=int(input())
    l.append(a)
for i in l:
    b = list(map(int, str(i)))
    b.sort(reverse=True)
    s = [str(i) for i in b]
    r = int("".join(s))
    print(r)