#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
void solve() {
  string s;
  cin >> s;
  vector<long long int> odd, even;
  for (auto i : s) {
    long long int t = i - '0';
    if (t % 2 == 0)
      even.push_back(t);
    else
      odd.push_back(t);
  }
  reverse(even.begin(), even.end());
  ;
  reverse(odd.begin(), odd.end());
  ;
  long long int c = 0;
  while (c < s.length()) {
    c++;
    if (even.size() > 0 && odd.size() > 0) {
      if (even.back() < odd.back()) {
        cout << even.back();
        even.pop_back();
      } else {
        cout << odd.back();
        odd.pop_back();
      }
    } else if (even.size() > 0) {
      cout << even.back();
      even.pop_back();
    } else {
      cout << odd.back();
      odd.pop_back();
    }
  }
  cout << '\n';
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
}
