#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int q;
  cin >> q;
  while (q--) {
    string s;
    cin >> s;
    vector<long long int> a, b;
    for (auto c : s) {
      long long int k = c - '0';
      if (k & 1)
        a.push_back(k);
      else
        b.push_back(k);
    }
    long long int x = 0, y = 0;
    while (x < a.size() and y < b.size()) {
      if (a[x] < b[y]) {
        cout << (char)(a[x] + '0');
        x++;
      } else {
        cout << (char)(b[y] + '0');
        y++;
      }
    }
    while (x < a.size()) {
      cout << (char)(a[x] + '0');
      x++;
    }
    while (y < b.size()) {
      cout << (char)(b[y] + '0');
      y++;
    }
    cout << endl;
  }
  return 0;
}
