#include <bits/stdc++.h>
using namespace std;
int t, b[400000], s0[400000], s1[400000], cnt1, cnt0;
char a[400000];
int main() {
  scanf("%d", &t);
  for (int s = 1; s <= t; s++) {
    cnt1 = 0, cnt0 = 0;
    cin >> a;
    int len = strlen(a);
    for (int i = 0; i < len; i++) b[i + 1] = a[i] - '0';
    for (int i = 1; i <= len; i++) {
      if (b[i] % 2 == 0)
        s0[++cnt0] = b[i];
      else
        s1[++cnt1] = b[i];
    }
    int l0 = 1, l1 = 1;
    for (int i = 1; i <= len; i++) {
      if (l0 <= cnt0 && l1 <= cnt1) {
        if (s0[l0] < s1[l1]) {
          printf("%d", s0[l0]);
          l0++;
        } else {
          printf("%d", s1[l1]);
          l1++;
        }
      }
      if (l0 > cnt0 && l1 <= cnt1) {
        printf("%d", s1[l1]);
        l1++;
      }
      if (l0 <= cnt0 && l1 > cnt1) {
        printf("%d", s0[l0]);
        l0++;
      }
    }
    printf("\n");
  }
  return 0;
}
