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