#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    string even = "", odd = "";
    for (int i = 0; i < s.length(); i++) {
      if ((s[i] - '0') % 2 == 0) {
        even += s[i];
      } else {
        odd += s[i];
      }
    }
    int i = 0, j = 0;
    string ans = "";
    while (i != even.length() && j != odd.length()) {
      if (odd[j] - '0' > even[i] - '0') {
        ans += even[i];
        i++;
      } else {
        ans += odd[j];
        j++;
      }
    }
    while (i != even.length()) {
      ans += even[i++];
    }
    while (j != odd.length()) {
      ans += odd[j++];
    }
    cout << ans << endl;
  }
}
