#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    string s, t1 = "", t2 = "", ans = "";
    cin >> s;
    int n = s.size();
    for (auto c : s) {
      if (c % 2)
        t1 += c;
      else
        t2 += c;
    }
    int ptr1 = 0, ptr2 = 0;
    for (int i = 0; i < n; i++) {
      if (ptr1 != t1.size() && (ptr2 == t2.size() || t1[ptr1] < t2[ptr2])) {
        ans += t1[ptr1];
        ptr1++;
      } else {
        ans += t2[ptr2];
        ptr2++;
      }
    }
    cout << ans << '\n';
  }
}
