#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    string a;
    cin >> a;
    stack<int> s1;
    stack<int> s2;
    for (int i = a.length() - 1; i >= 0; i--) {
      if (((int)a[i] - 48) % 2 == 0) {
        s1.push((int)a[i] - 48);
      } else {
        s2.push((int)a[i] - 48);
      }
    }
    while (!s1.empty() && !s2.empty()) {
      if (s1.top() < s2.top()) {
        cout << s1.top();
        s1.pop();
      } else {
        cout << s2.top();
        s2.pop();
      }
    }
    while (!s1.empty()) {
      cout << s1.top();
      s1.pop();
    }
    while (!s2.empty()) {
      cout << s2.top();
      s2.pop();
    }
    cout << endl;
  }
  return 0;
}
