#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    vector<long long> e, o;
    long long n = s.length();
    for (long long i = 0; i < n; i++) {
      if ((s[i] - '0') % 2)
        o.push_back(s[i] - '0');
      else
        e.push_back(s[i] - '0');
    }
    long long i = 0, j = 0;
    while (i < o.size() || j < e.size()) {
      if (i == o.size()) {
        while (j < e.size()) cout << e[j++];
      } else if (j == e.size()) {
        while (i < o.size()) cout << o[i++];
      } else {
        if (o[i] < e[j])
          cout << o[i++];
        else
          cout << e[j++];
      }
    }
    cout << "\n";
  }
}
