#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  ;
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    string arr[2];
    for (long long int i = 0; i <= s.length() - 1; i++) {
      arr[(s[i] - '0') & 1] += s[i];
    }
    string res = "";
    reverse(arr[0].begin(), arr[0].end());
    reverse(arr[1].begin(), arr[1].end());
    while (!(arr[0].empty() && arr[1].empty())) {
      if (arr[0].empty()) {
        res += arr[1].back();
        arr[1].pop_back();
        continue;
      }
      if (arr[1].empty()) {
        res += arr[0].back();
        arr[0].pop_back();
        continue;
      }
      if (arr[0].back() < arr[1].back()) {
        res += arr[0].back();
        arr[0].pop_back();
      } else {
        res += arr[1].back();
        arr[1].pop_back();
      }
    }
    cout << res << "\n";
  }
  return 0;
}
