#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    string even, odd;
    for (long long int i = 0; i < s.size(); i++) {
      if ((s[i] - '0') % 2 == 0)
        even += s[i];
      else
        odd += s[i];
    }
    string ans;
    long long int i, j;
    for (i = 0, j = 0; i < even.length() && j < odd.length();) {
      if (even[i] < odd[j]) {
        ans += even[i];
        i++;
      } else {
        ans += odd[j];
        j++;
      }
    }
    if (i < even.length()) {
      while (i < even.length()) {
        ans += even[i];
        i++;
      }
    }
    if (j < odd.length()) {
      while (j < odd.length()) {
        ans += odd[j];
        j++;
      }
    }
    cout << ans << "\n";
  }
  return 0;
}
