#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = LLONG_MAX;
void solve() {
  string s;
  cin >> s;
  string odd, even;
  for (long long i = 0; i < (long long)s.size(); i++) {
    if ((s[i] - '0') % 2 == 0)
      even.push_back(s[i]);
    else
      odd.push_back(s[i]);
  }
  string res;
  for (long long i = 0; i < (long long)s.size(); i++) {
    if (even.size() > 0 && odd.size() > 0) {
      if (even[0] > odd[0]) {
        res.push_back(odd[0]);
        odd.erase(odd.begin());
      } else {
        res.push_back(even[0]);
        even.erase(even.begin());
      }
    } else {
      if (even.size() == 0) {
        res.push_back(odd[0]);
        odd.erase(odd.begin());
      } else {
        res.push_back(even[0]);
        even.erase(even.begin());
      }
    }
  }
  cout << res << endl;
}
int main() {
  int t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
