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