#include <bits/stdc++.h>
using namespace std;
int main() {
  int Q;
  cin >> Q;
  for (int q = 0; q < Q; q++) {
    string inp;
    cin >> inp;
    vector<char> even;
    vector<char> odd;
    even.reserve(inp.size());
    odd.reserve(inp.size());
    for (auto c : inp) {
      if ((c - '0') & 1) {
        even.push_back(c);
      } else {
        odd.push_back(c);
      }
    }
    int odd_p = 0;
    int even_p = 0;
    while (odd_p < odd.size() && even_p < even.size()) {
      if (even[even_p] < odd[odd_p]) {
        cout << even[even_p];
        even_p++;
      } else {
        cout << odd[odd_p];
        odd_p++;
      }
    }
    while (odd_p < odd.size()) {
      cout << odd[odd_p];
      odd_p++;
    }
    while (even_p < even.size()) {
      cout << even[even_p];
      even_p++;
    }
    cout << endl;
  }
}
