#include <bits/stdc++.h>
using namespace std;
using vi = vector<long long>;
const long long inf = 1e18;
const long long mod = 1e9 + 7;
unsigned long long power(long long x, unsigned long long y, long long p) {
  long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
bool isPrime(long long n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (long long i = 5; i * i <= n; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) return false;
  return true;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long t;
  cin >> t;
  ;
  while (t--) {
    string s;
    cin >> s;
    deque<long long> od, ev;
    for (long long i = 0; i < s.size(); i++) {
      if ((s[i] - '0') % 2)
        od.push_back(i);
      else
        ev.push_back(i);
    }
    string t = "";
    while (od.size() != 0 || ev.size() != 0) {
      if (od.size() == 0) {
        while (ev.size() != 0) {
          t += s[ev.front()];
          ev.pop_front();
        }
        break;
      }
      if (ev.size() == 0) {
        while (od.size() != 0) {
          t += s[od.front()];
          od.pop_front();
        }
        break;
      }
      char c = s[od.front()], d = s[ev.front()];
      if (c < d) {
        t += s[od.front()];
        od.pop_front();
      } else {
        t += d;
        ev.pop_front();
      }
    }
    cout << t << "\n";
  }
}
