#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    int n = s.size();
    vector<char> even, odd;
    for (int i = 0; i < n; i++) {
      if ((s[i] - '0') % 2 == 0) {
        even.push_back(s[i]);
      } else {
        odd.push_back(s[i]);
      }
    }
    int n1 = even.size();
    int n2 = odd.size();
    int l1 = 0;
    int l2 = 0;
    for (int i = 0; i < n; i++) {
      if (l1 < n1 && l2 < n2) {
        if (even[l1] < odd[l2]) {
          s[i] = even[l1];
          l1++;
        } else {
          s[i] = odd[l2];
          l2++;
        }
      } else if (l1 < n1) {
        s[i] = even[l1];
        l1++;
      } else {
        s[i] = odd[l2];
        l2++;
      }
    }
    cout << s << endl;
  }
  return 0;
}
