#include <bits/stdc++.h>
using namespace std;
int main() {
  int q;
  cin >> q;
  while (q--) {
    string s;
    cin >> s;
    vector<int> p, n;
    for (int i = 0; i < s.size(); ++i) {
      if (s[i] % 2 == 0)
        p.push_back(s[i] - 48);
      else
        n.push_back(s[i] - 48);
    }
    int i = 0, j = 0;
    while (i < p.size() || j < n.size()) {
      if (i == p.size())
        cout << n[j++];
      else if (j == n.size())
        cout << p[i++];
      else {
        if (p[i] < n[j])
          cout << p[i++];
        else
          cout << n[j++];
      }
    }
    cout << "\n";
  }
}
