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