#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  string s;
  while (t--) {
    cin >> s;
    vector<int> E, O;
    int io = 0, ie = 0, prev = -1;
    for (int i = 0; i < s.size(); ++i) {
      if ((s[i] - 48) % 2 == 0) {
        if (io < O.size() && ie < E.size() && prev == 1) {
          while (io < O.size() && ie < E.size()) {
            if (O[io] < E[ie])
              cout << O[io++];
            else
              cout << E[ie++];
          }
        }
        E.push_back(s[i] - 48);
        prev = 0;
      } else {
        if (io < O.size() && ie < E.size() && prev == 0) {
          while (io < O.size() && ie < E.size()) {
            if (O[io] < E[ie])
              cout << O[io++];
            else
              cout << E[ie++];
          }
        }
        O.push_back(s[i] - 48);
        prev = 1;
      }
    }
    if (io < O.size() && ie < E.size()) {
      while (io < O.size() && ie < E.size()) {
        if (O[io] < E[ie])
          cout << O[io++];
        else
          cout << E[ie++];
      }
    }
    while (io < O.size()) cout << O[io++];
    while (ie < E.size()) cout << E[ie++];
    cout << endl;
  }
  return 0;
}
