#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    string e = "", o = "";
    for (int i = 0; i < s.size(); i++) {
      if ((s[i] - '0') % 2 == 0)
        e += s[i];
      else
        o += s[i];
    }
    string ans = "";
    int i = 0, j = 0;
    while (i < e.size() && j < o.size()) {
      if (e[i] - '0' > o[j] - '0') {
        ans += o[j];
        j++;
      } else {
        ans += e[i];
        i++;
      }
    }
    if (i < e.size()) {
      while (i < e.size()) {
        ans += e[i];
        i++;
      }
    }
    if (j < o.size()) {
      while (j < o.size()) {
        ans += o[j];
        j++;
      }
    }
    cout << ans << endl;
  }
  return 0;
}
