#include <bits/stdc++.h>
using namespace std;
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  for (auto i : v) os << i << " ";
  return os;
}
template <typename T>
ostream& operator<<(ostream& os, const set<T>& v) {
  for (auto i : v) os << i << " ";
  return os;
}
string ans;
void sol(string& x, string& y) {
  int i, j;
  i = j = 0;
  while (i < x.size() && j < y.size()) {
    if (i >= x.size() || (j < y.size() && y[j] < x[i]))
      ans += y[j++];
    else if (j >= y.size() || (i < x.size() && x[i] < y[j]))
      ans += x[i++];
  }
  if (i < x.size())
    y = x.substr(i);
  else if (j < y.size())
    y = y.substr(j);
}
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    string str;
    cin >> str;
    ans = "";
    string l, r;
    l = "";
    r = "";
    for (int i = 0; i < str.size(); ++i) {
      int type = (str[i] - '0') & 1;
      if (type)
        l += str[i];
      else
        r += str[i];
    }
    sol(l, r);
    cout << ans << r << endl;
  }
  return 0;
}
