#include <bits/stdc++.h>
using namespace std;
template <class T>
void print(T a) {
  for (auto x : a) cout << x << ' ';
  cout << '\n';
}
template <class T, class U>
inline istream& operator>>(istream& str, pair<T, U>& p) {
  return str >> p.first >> p.second;
}
template <class T, class U>
inline ostream& operator<<(ostream& str, pair<T, U>& p) {
  return str << p.first << ' ' << p.second;
}
auto random_address = [] {
  char* p = new char;
  delete p;
  return uint64_t(p);
};
const uint64_t SEED = chrono::steady_clock::now().time_since_epoch().count() *
                      (random_address() | 1);
mt19937_64 rng(SEED);
void solve() {
  string s;
  cin >> s;
  long long n = (long long)s.size();
  vector<long long> a, b;
  for (long long i = 0; i < n; i++) {
    long long num = s[i] - '0';
    if (num & 1)
      a.push_back(num);
    else
      b.push_back(num);
  }
  long long l = 0, r = 0;
  vector<long long> ans;
  while ((l < (long long)a.size()) || (r < (long long)b.size())) {
    if (l == (long long)a.size()) {
      ans.push_back(b[r]);
      r++;
    } else if (r == (long long)b.size()) {
      ans.push_back(a[l]);
      l++;
    } else if (a[l] < b[r]) {
      ans.push_back(a[l]);
      l++;
    } else {
      ans.push_back(b[r]);
      r++;
    }
  }
  for (long long x : ans) cout << x;
  cout << '\n';
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  cin >> t;
  for (long long i = 0; i < t; i++) {
    solve();
  }
  return 0;
}
