#include <bits/stdc++.h>
using namespace std;
long long xyp(long long x, long long y) {
  if (y == 0) return 1LL;
  if (y == 1) return x;
  if (y % 2) {
    long long p = xyp(x, y - 1);
    return (x * p) % 1000000007;
  }
  long long p = xyp(x, y / 2);
  return (p * p) % 1000000007;
}
long long inv(long long x) { return xyp(x, 1000000007 - 2); }
long long fact[10000007];
long long pr[10000007];
vector<long long> rp;
void init() {
  fact[0] = 1;
  for (long long i = 1; i < 10000007; i++) {
    fact[i] = (fact[i - 1] * i) % 1000000007;
  }
}
long long ncr(long long n, long long r) {
  if (r < 0) return 0LL;
  if (r == 0 || n == r) return 1LL;
  if (r == 1 || ((n - r) == 1)) return n;
  long long p =
      (((fact[n] * inv(fact[r])) % 1000000007) * inv(fact[n - r])) % 1000000007;
  return p;
}
void sieve() {
  memset(pr, 1, sizeof(pr));
  pr[0] = pr[1] = 0;
  for (long long i = 2; i < 10000007; i++) {
    if (pr[i]) {
      rp.push_back(i);
      for (long long j = i * i; j < 10000007; j += i) {
        pr[j] = 0;
      }
    }
  }
}
void solve() {
  string second;
  cin >> second;
  string eve = "", odd = "";
  for (auto x : second) {
    if (x % 2)
      odd += x;
    else
      eve += x;
  }
  while (odd.size() > 0 && eve.size() > 0) {
    if (odd[0] < eve[0]) {
      cout << odd[0];
      odd.erase(odd.begin());
    } else {
      cout << eve[0];
      eve.erase(eve.begin());
    }
  }
  cout << odd << eve << "\n";
  ;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t1;
  cin >> t1;
  long long z = 1;
  while (t1--) {
    solve();
  }
  return 0;
}
