#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 5;
char s[N], a[N], b[N], c[N];
int n, m, l;
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    n = m = l = 0;
    scanf("%s", s);
    for (int i = 0; s[i]; i++) {
      int x = s[i] - '0';
      if (x & 1)
        a[n++] = s[i];
      else
        b[m++] = s[i];
    }
    int p1 = 0, p2 = 0;
    while (p1 < n || p2 < m) {
      if (p1 >= n)
        c[l++] = b[p2++];
      else if (p2 >= m)
        c[l++] = a[p1++];
      else if (a[p1] < b[p2])
        c[l++] = a[p1++];
      else
        c[l++] = b[p2++];
    }
    c[l] = 0;
    printf("%s\n", c);
  }
  return 0;
}
