#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
template <typename T>
bool uax(T &a, const T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool uin(T &a, const T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T1, typename T2>
istream &operator>>(istream &in, pair<T1, T2> &p) {
  in >> p.first >> p.second;
  return in;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &out, pair<T1, T2> &p) {
  out << p.first << ' ' << p.second;
  return out;
}
mt19937 rnd(1928);
int q;
string s, ct, nc;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> q;
  while (q--) {
    cin >> s;
    ct.clear();
    nc.clear();
    for (int i = 0; i < s.size(); i++) {
      if ((s[i] - '0') % 2 == 0) {
        ct += s[i];
      } else {
        nc += s[i];
      }
    }
    string h;
    int i1 = 0, i2 = 0;
    while (i1 < ct.size() && i2 < nc.size()) {
      if (ct[i1] < nc[i2]) {
        h += ct[i1];
        i1++;
      } else {
        h += nc[i2];
        i2++;
      }
    }
    while (i1 < ct.size()) {
      h += ct[i1];
      i1++;
    }
    while (i2 < nc.size()) {
      h += nc[i2];
      i2++;
    }
    cout << h << "\n";
  }
}
