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