#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    string a;
    cin >> a;
    vector<long long> v[2];
    for (auto x : a) {
      v[(x - '0') & 1].push_back(x - '0');
    }
    reverse(v[0].begin(), v[0].end());
    reverse(v[1].begin(), v[1].end());
    vector<long long> res;
    while (!v[0].empty() or !v[1].empty()) {
      if (v[0].empty()) {
        res.push_back(v[1].back());
        v[1].pop_back();
      } else if (v[1].empty()) {
        res.push_back(v[0].back());
        v[0].pop_back();
      } else if (v[0].back() < v[1].back()) {
        res.push_back(v[0].back());
        v[0].pop_back();
      } else {
        res.push_back(v[1].back());
        v[1].pop_back();
      }
    }
    for (auto x : res) {
      cout << x;
    }
    cout << '\n';
  }
}
