#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int tn;
  cin >> tn;
  while (tn--) {
    string s;
    cin >> s;
    int n = (int)s.size();
    vector<int> even, odd;
    for (int i = 0; i < n; i++) {
      if ((s[i] - '0') % 2) {
        odd.push_back(s[i] - '0');
      } else {
        even.push_back(s[i] - '0');
      }
    }
    int e = 0, o = 0;
    vector<int> ans;
    while (e < (int)even.size() && o < (int)odd.size()) {
      if (even[e] < odd[o]) {
        ans.push_back(even[e]);
        e++;
      } else {
        ans.push_back(odd[o]);
        o++;
      }
    }
    while (e < (int)even.size()) {
      ans.push_back(even[e]);
      e++;
    }
    while (o < (int)odd.size()) {
      ans.push_back(odd[o]);
      o++;
    }
    assert((int)ans.size() == n);
    for (int i = 0; i < n; i++) {
      cout << ans[i];
    }
    cout << '\n';
  }
  return 0;
}
