Question
The Price Tag Puzzle
In a bustling marketplace, a savvy merchant named Riya found a price tag showing an integer N on her prized artifact. She could exchange any two digits of this number once to maximize its value.Can you help Riya determine the highest possible price she can achieve by making a at most a single exchange?
Input
The first line of the input contains T, denoting the number of test cases.
For each test case, You are given the value of N, denoting the number.
Constraints
1 ≤ T ≤ 10
1 ≤ N ≤ 108
For each test case, You are given the value of N, denoting the number.
Constraints
1 ≤ T ≤ 10
1 ≤ N ≤ 108
Output
For each test case return the highest possible price.
Example
Sample Input
1
312
Sample Output
321
Explanation
Digit 1 can be exchanged with 2 to get 321, which is the highest possible price with one exchange.
1
312
Sample Output
321
Explanation
Digit 1 can be exchanged with 2 to get 321, which is the highest possible price with one exchange.