#include <bits/stdc++.h>
using namespace std;
int q;
string s;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> q;
  while (q--) {
    cin >> s;
    vector<int> odd;
    vector<int> even;
    int cur;
    for (int i = 0; i < s.length(); i++) {
      cur = s[i] - '0';
      if (cur % 2 == 0)
        even.push_back(cur);
      else
        odd.push_back(cur);
    }
    odd.push_back(1e9 + 9);
    even.push_back(1e9 + 9);
    int o = 0, e = 0;
    vector<int> ans;
    while (o < odd.size() - 1 || e < even.size() - 1) {
      if (odd[o] <= even[e]) {
        ans.push_back(odd[o]);
        o++;
        o = min(o, int(odd.size()) - 1);
      } else {
        ans.push_back(even[e]);
        e++;
        e = min(e, int(even.size()) - 1);
      }
    }
    for (int i : ans) cout << i;
    cout << endl;
  }
  return 0;
}
