#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> pp;
typedef vector<pp> vp;
typedef map<pp, ll> ipi;
typedef map<pp, char> ipc;
typedef map<ll, ll> ii;
typedef set<ll> sl;
typedef multiset<ll> msl;
typedef map<char, ll> ci;
typedef set<pair<ll, ll>> sp;
const ll mod = 1e9 + 7;
const ll N = 2e5 + 1;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ll t;
  cin >> t;
  while (t--) {
    vl o, e;
    string s;
    cin >> s;
    for (auto i : s) {
      if ((i - '0') % 2)
        o.emplace_back(i - '0');
      else
        e.emplace_back(i - '0');
    }
    ll i = 0, j = 0;
    vl ans;
    while (i < o.size() && j < e.size()) {
      if (o[i] < e[j]) {
        ans.emplace_back(o[i]);
        i++;
      } else {
        ans.emplace_back(e[j]);
        j++;
      }
    }
    while (i < o.size()) {
      ans.emplace_back(o[i]);
      i++;
    }
    while (j < e.size()) {
      ans.emplace_back(e[j]);
      j++;
    }
    for (auto i : ans) cout << i;
    cout << "\n";
  }
  return 0;
}
