Problem: You are given a huge integer consisting of digits ( is between and , inclusive). It may contain leading zeros.
You can swap two digits on adjacent (neighboring) positions if the swapping digits are of different parity (that is, they have different remainders when divided by ).
For example, if you can get the following integers in a single operation:
- if you swap the first and the second digits;
- if you swap the second and the third digits;
- if you swap the fifth and the sixth digits;
- if you swap the sixth and the seventh digits;
- if you swap the seventh and the eighth digits.
Note, that you can't swap digits on positions and because the positions are not adjacent. Also, you can't swap digits on positions and because the digits have the same parity.
You can perform any number (possibly, zero) of such operations.
Find the minimum integer you can obtain.
Note that the resulting integer also may contain leading zeros.
Input Format: The first line contains one integer () — the number of test cases in the input.
The only line of each test case contains the integer , its length is between and , inclusive.
It is guaranteed that the sum of all values does not exceed .
Output Format: For each test case print line — the minimum integer you can obtain.
Note: In the first test case, you can perform the following sequence of operations (the pair of swapped digits is highlighted): .
In the second test case, the initial integer is optimal.
In the third test case you can perform the following sequence of operations: .