#include <bits/stdc++.h>
using namespace std;
queue<char> o, e;
int main() {
  int t, t1;
  string s, ans;
  cin >> t;
  while (t--) {
    cin >> s;
    for (int i = 0; i < s.size(); i++) {
      t1 = int(s[i] - '0');
      if (t1 % 2)
        o.push(s[i]);
      else
        e.push(s[i]);
    }
    ans = "";
    while (!o.empty() && !e.empty()) {
      if (o.front() < e.front()) {
        ans += o.front();
        o.pop();
      } else {
        ans += e.front();
        e.pop();
      }
    }
    while (!o.empty()) {
      ans += o.front();
      o.pop();
    }
    while (!e.empty()) {
      ans += e.front();
      e.pop();
    }
    cout << ans << "\n";
  }
  return 0;
}
