#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int T;
  cin >> T;
  while (T--) {
    long long int n, i, j, k, l, o, p;
    deque<long long int> odd, even;
    string s;
    cin >> s;
    n = s.size();
    for (long long int i = 0; i <= n - 1; i++) {
      k = ((long long int)(s[i] - '0'));
      if (k % 2 == 0)
        even.push_back(k);
      else
        odd.push_back(k);
    }
    vector<long long int> x, y, ans;
    while ((!odd.empty()) && (!even.empty())) {
      do {
        o = odd.front();
        l = even.front();
        x.push_back(o);
        y.push_back(l);
        odd.pop_front();
        even.pop_front();
      } while (l == o);
      if (o <= l) {
        for (auto z : x) ans.push_back(z);
        for (auto z : y) even.push_front(z);
        x.clear();
        y.clear();
      } else {
        for (auto z : y) ans.push_back(z);
        for (auto z : x) odd.push_front(z);
        y.clear();
        x.clear();
      }
    }
    while (!(odd.empty())) {
      ans.push_back(odd.front());
      odd.pop_front();
    }
    while (!(even.empty())) {
      ans.push_back(even.front());
      even.pop_front();
    }
    for (auto z : ans) cout << z;
    cout << '\n';
  }
  return 0;
}
