Farouk's course registration opens tonight at midnight, but he's having some trouble logging into banner. Not knowing what a password manager is, Farouk still creates his own passwords and writes them down in his notebook. He generates his passwords in an interesting way. He starts with a string $$$s$$$ of length $$$n$$$ consisting of lowercase English letters. Then, he is only allowed to make the following operation:
A string $$$a$$$ is lexicographically smaller than a string $$$b$$$ if and only if one of the following holds:
$$$^{\text{∗}}$$$$$$\oplus$$$ denotes the bitwise XOR operation.
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) – the number of test cases.
The only line of each test case contains a single string $$$s$$$ ($$$1 \le |s| \le 2 \cdot 10^5$$$) consisting of lowercase English letters, where $$$|s|$$$ denotes the length of the string.
It is guaranteed that the the sum of $$$|s|$$$ over all test cases does not exceed $$$2 \cdot 10^5$$$.
For each test case output a single string – the lexicographically minimum string that can be reached from the starting string.
4dogabcdefghgoodpasswordonetwothreefour
dgoabcdefghgooadpsdorswoenottweefhorru
In the first test case, o and g can be swapped since $$$2 \oplus 3 = 1 \lt 2 = \min(2, 3)$$$ to get "dgo" which is the lexicographically smallest arrangement ($$$d \le g \le o$$$).
In the second test case, no operations were performed since it is already lexicographically smallest.