#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    int n = s.length();
    int a[n + 1], ans[n + 1];
    for (int i = 1; i <= n; i++) a[i] = s[i - 1] - '0';
    int left = 1, odd = 1, even = 1;
    while ((odd <= n) || (even <= n)) {
      while ((odd <= n) && (a[odd] % 2 == 0)) odd++;
      while ((even <= n) && (a[even] % 2)) even++;
      if (even > n)
        ans[left++] = a[odd++];
      else if (odd > n)
        ans[left++] = a[even++];
      else if (a[odd] < a[even])
        ans[left++] = a[odd++];
      else
        ans[left++] = a[even++];
    }
    for (int i = 1; i <= n; i++) cout << ans[i];
    cout << "\n";
  }
  return 0;
}
