#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long int t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    vector<long long int> V1, V2;
    long long int i, j;
    for (i = 0; i < s.length(); i++) {
      if ((s[i] - '0') % 2 == 0)
        V1.push_back(s[i] - '0');
      else
        V2.push_back(s[i] - '0');
    }
    i = 0;
    j = 0;
    while (i < V1.size() && j < V2.size()) {
      if (V1[i] < V2[j])
        cout << V1[i++];
      else
        cout << V2[j++];
    }
    while (i < V1.size()) cout << V1[i++];
    while (j < V2.size()) cout << V2[j++];
    cout << endl;
  }
}
