#include <bits/stdc++.h>
using namespace std;
vector<vector<long long> > adj;
vector<bool> vis;
void fast() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}
vector<long long> sieve(long long n) {
  vector<bool> isPrime(n + 1, true);
  isPrime[0] = false;
  isPrime[1] = false;
  vector<long long> primes;
  for (long long i = 2; i * i <= n; ++i) {
    if (isPrime[i]) {
      for (long long j = 2 * i; j <= n; j += i) {
        isPrime[j] = false;
      }
    }
  }
  for (long long i = 0; i < isPrime.size(); i += 1) {
    if (isPrime[i]) {
      primes.push_back(i);
    }
  }
  return primes;
}
long long powerMod(long long x, long long y, long long m) {
  long long res = 1;
  while (y > 0) {
    if (y & 1) {
      res = (res * x) % m;
    }
    y >>= 1;
    x = (x * x) % m;
  }
  return res;
}
long long modInverse(long long x, long long m) { return powerMod(x, m - 2, m); }
void dfs(long long node) {
  vis[node] = true;
  for (auto num : adj[node]) {
    if (!vis[num]) {
      dfs(num);
    }
  }
}
long double dist2d(long long x1, long long y1, long long x2, long long y2) {
  return sqrt((long double)((x1 - x2) * (x1 - x2)) +
              (long double)((y1 - y2) * (y1 - y2)));
}
long double dist3d(long long x1, long long y1, long long z1, long long x2,
                   long long y2, long long z2) {
  return sqrt((long double)((x1 - x2) * (x1 - x2)) +
              (long double)((y1 - y2) * (y1 - y2)) +
              (long double)((z1 - z2) * (z1 - z2)));
}
long double slope(long long x1, long long y1, long long x2, long long y2) {
  return (long double)(y2 - y1) / (long double)(x2 - x1);
}
long long dotProduct(vector<long long> a, vector<long long> b) {
  long long sum = 0;
  for (long long i = 0; i < a.size(); i += 1) {
    sum += a[i] * b[i];
  }
  return sum;
}
using namespace std;
int main() {
  fast();
  long long t, n, i, j, k, x, y, c, m;
  cin >> t;
  while (t--) {
    string str;
    cin >> str;
    n = str.size();
    long long a[n];
    for (long long i = 0; i < n; i += 1) {
      a[i] = str[i] - '0';
    }
    vector<long long> odd, even;
    for (long long i = 0; i < n; i += 1) {
      if (a[i] & 1) {
        odd.push_back(a[i]);
      } else {
        even.push_back(a[i]);
      }
    }
    i = 0;
    j = 0;
    vector<long long> res;
    while (i < odd.size() || j < even.size()) {
      if (i == odd.size() && j < even.size()) {
        res.push_back(even[j]);
        ++j;
        continue;
      }
      if (j == even.size() && i < odd.size()) {
        res.push_back(odd[i]);
        ++i;
        continue;
      }
      if (odd[i] < even[j]) {
        res.push_back(odd[i]);
        ++i;
      } else {
        res.push_back(even[j]);
        ++j;
      }
    }
    for (long long i = 0; i < res.size(); i += 1) cout << res[i];
    cout << '\n';
    ;
  }
}
