#include <bits/stdc++.h>
using namespace std;
const int modd = 1000000007;
int t;
char s[300010];
int even[300010];
int odd[300010];
int main() {
  ios::sync_with_stdio(false);
  scanf("%d", &t);
  while (t--) {
    scanf("%s", s);
    memset(odd, 0, sizeof(odd));
    memset(even, 0, sizeof(even));
    int len = strlen(s);
    int oddsum = 0, evensum = 0;
    for (int i = 0; i < len; i++) {
      int temp = s[i] - '0';
      if (temp & 1 == 1) {
        odd[oddsum] = temp;
        oddsum++;
      } else {
        even[evensum] = temp;
        evensum++;
      }
    }
    int oddx = 0, eveny = 0;
    while (oddx < oddsum || eveny < evensum) {
      if (oddx == oddsum) {
        printf("%d", even[eveny]);
        eveny++;
        continue;
      }
      if (eveny == evensum) {
        printf("%d", odd[oddx]);
        oddx++;
        continue;
      }
      int od = odd[oddx], ey = even[eveny];
      if (ey < od) {
        printf("%d", ey);
        eveny++;
        continue;
      } else {
        printf("%d", od);
        oddx++;
        continue;
      }
    }
    printf("\n");
  }
  return 0;
}
