#include <bits/stdc++.h>
void solve(void);
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  long long int t;
  cin >> t;
  while (t--) solve();
}
void solve() {
  string s;
  cin >> s;
  long long int n = s.length();
  string a = "", b = "", c = "";
  for (long long int i = 0; i < n; i++) {
    long long int k = s[i] - 48;
    if (k % 2 == 0)
      a += s[i];
    else
      b += s[i];
  }
  reverse((a).begin(), (a).end());
  reverse((b).begin(), (b).end());
  while (!a.empty() && !b.empty()) {
    long long int x = a.back() - 48;
    long long int y = b.back() - 48;
    if (x > y) {
      c += b.back();
      b.pop_back();
    } else {
      c += a.back();
      a.pop_back();
    }
  }
  while (!a.empty()) {
    c += a.back();
    a.pop_back();
  }
  while (!b.empty()) {
    c += b.back();
    b.pop_back();
  }
  for (long long int i = 0; i < c.length(); i++) {
    cout << c[i];
  }
  cout << endl;
}
