Let S be a string containing the digits of a (possibly large) positive integer. For example, S="1147" represents the integer 1147. S will not have any leading zeros.
You are allowed to swap one pair of digits in the given number. In other words, you may choose a pair of distinct indices i and j, and swap the characters S[i] and S[j]. Note that you may also leave the original number unchanged. The new string must again describe a valid positive integer, i.e., it must not have any leading zeros.
Your task is to find out the string that represents the smallest possible integer that can be obtained.
The input begins with a line containing an integer T (T<=150), which indicates the number of test cases. Each case contains a string S. S contains only digits (‘0’-‘9’), and its length is between 2 and 50, inclusive.
For each case, output the smallest possible integer in a line.
459693561549172751410234
56913569149172755410234