#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    string s, e = "", o = "";
    cin >> s;
    int n = s.size();
    if (n == 1) {
      cout << s << endl;
      continue;
    }
    for (int i = 0; i < n; i++) {
      int p = s[i] - '0';
      if (p % 2 == 0)
        e += s[i];
      else
        o += s[i];
    }
    string ans = "";
    while (!e.empty() && !o.empty()) {
      int a = INT_MIN, b = INT_MIN;
      if (!e.empty()) a = e[0] - '0';
      if (!o.empty()) b = o[0] - '0';
      if (a < b) {
        ans += e[0];
        e.erase(0, 1);
      } else {
        ans += o[0];
        o.erase(0, 1);
      }
    }
    if (!e.empty()) ans += e;
    if (!o.empty()) ans += o;
    cout << ans << "\n";
  }
  return 0;
}
