#include <bits/stdc++.h>
using namespace std;
long long mPow(long long a, long long b) {
  long long mod = 1000000007;
  a %= mod;
  if (b == 0) {
    return 1;
  } else if (b % 2 == 0) {
    return mPow(a * a, b / 2) % mod;
  } else {
    return (mPow(a, b - 1) * a) % mod;
  }
}
bool is_chem(vector<int>& a) {
  vector<int> out(3);
  for (int i = 0; i < 3; i++) {
    out[i] = a[i];
  }
  int centre = a[3];
  vector<int> in(3);
  for (int i = 0; i < 3; i++) {
    in[i] = a[i + 4];
  }
  if ((out[1] + out[2] + centre) % 2 != in[0]) {
    return false;
  }
  if ((out[2] + out[0] + centre) % 2 != in[1]) {
    return false;
  }
  if ((out[0] + out[1] + centre) % 2 != in[2]) {
    return false;
  }
  return true;
}
bool cmp(const string& a, const string& b) { return a.size() < b.size(); }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    queue<char> a;
    queue<char> b;
    for (int i = 0; i < s.size(); i++) {
      if ((s[i] - '0') % 2 == 0) {
        a.push(s[i]);
      } else {
        b.push(s[i]);
      }
    }
    vector<char> ans;
    while (!a.empty() or !b.empty()) {
      if (a.empty()) {
        while (!b.empty()) {
          char v = b.front();
          ans.push_back(v);
          b.pop();
        }
      }
      if (b.empty()) {
        while (!a.empty()) {
          char v = a.front();
          ans.push_back(v);
          a.pop();
        }
      } else {
        char u = a.front();
        char v = b.front();
        if (u < v) {
          ans.push_back(u);
          a.pop();
        } else {
          ans.push_back(v);
          b.pop();
        }
      }
    }
    for (char v : ans) {
      cout << v;
    }
    cout << endl;
  }
  return 0;
}
