#include <bits/stdc++.h>
using namespace std;
using Pi = pair<int, int>;
using ll = long long;
string to_string(string s) { return s; }
template <class S, class T>
string to_string(pair<S, T> p) {
  return "{" + to_string(p.first) + "," + to_string(p.second) + "}";
}
template <class S>
string to_string(unordered_set<S> s) {
  string ret = "{";
  for (S x : s) ret += to_string(x) + ",";
  return ret + "}";
}
template <class S, class T>
string to_string(map<S, T> m) {
  string ret = "{";
  for (pair<S, T> x : m) ret += to_string(x) + ",";
  return ret + "}";
}
template <class T>
string to_string(vector<T> v) {
  string ret = "{";
  for (int i = 0; i < (int)v.size() - 1; ++i) {
    ret += to_string(v[i]) + ",";
  }
  if (v.size() > 0) {
    ret += to_string(v.back());
  }
  ret += "}";
  return ret;
}
void debug() { cerr << endl; }
template <class Head, class... Tail>
void debug(Head head, Tail... tail) {
  cerr << to_string(head) << " ";
  debug(tail...);
}
void print() { cout << endl; }
template <class Head, class... Tail>
void print(Head head, Tail... tail) {
  cout << to_string(head);
  print(tail...);
}
int main() {
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    string a;
    cin >> a;
    queue<int> q[2];
    for (char c : a) q[c % 2].push(c - '0');
    for (int i = 0; i < (int)a.size(); i++) {
      if (q[1].empty() || (!q[0].empty() && q[0].front() < q[1].front())) {
        printf("%d", q[0].front());
        q[0].pop();
      } else {
        printf("%d", q[1].front());
        q[1].pop();
      }
    }
    printf("\n");
  }
  return 0;
}
