#include <bits/stdc++.h>
using namespace std;
double _eps = 1e-6;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  int T;
  cin >> T;
  for (int caseno = 1; caseno <= T; caseno++) {
    string s;
    cin >> s;
    string o, e;
    for (char ch : s) {
      if ((ch - '0') % 2 == 0)
        e.push_back(ch);
      else
        o.push_back(ch);
    }
    reverse((o).begin(), (o).end());
    reverse((e).begin(), (e).end());
    while (!o.empty() && !e.empty()) {
      if (o.back() > e.back())
        cout << e.back(), e.pop_back();
      else
        cout << o.back(), o.pop_back();
    }
    while (!o.empty()) cout << o.back(), o.pop_back();
    while (!e.empty()) cout << e.back(), e.pop_back();
    puts("");
  }
  return 0;
}
