#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3e5 + 5;
int T, n;
char s[MAXN];
char a[MAXN], b[MAXN];
int cnt1, cnt2;
string ans;
int main() {
  int i, j;
  cin >> T;
  while (T--) {
    cnt1 = cnt2 = 0;
    ans = "";
    cin >> s + 1;
    int l = strlen(s + 1);
    for (i = (1); i <= (l); i++) {
      int tmp = s[i] - '0';
      if (tmp & 1) {
        a[++cnt1] = s[i];
      } else {
        b[++cnt2] = s[i];
      }
    }
    i = j = 1;
    while (i <= cnt1 || j <= cnt2) {
      if (i > cnt1) {
        ans += b[j++];
      } else if (j > cnt2) {
        ans += a[i++];
      } else if (a[i] < b[j]) {
        ans += a[i++];
      } else
        ans += b[j++];
    }
    cout << ans << endl;
  }
  return 0;
}
