#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int N = 3e5 + 5;
char s[N];
vector<int> even;
vector<int> odd;
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    scanf("%s", s + 1);
    int len = strlen(s + 1);
    for (int i = 1; i <= len; i++) {
      int t = s[i] - '0';
      if (t % 2 == 0)
        even.push_back(t);
      else
        odd.push_back(t);
    }
    int i = 0, j = 0;
    while (i < odd.size() && j < even.size()) {
      if (odd[i] < even[j])
        printf("%d", odd[i++]);
      else
        printf("%d", even[j++]);
    }
    while (i < odd.size()) printf("%d", odd[i++]);
    while (j < even.size()) printf("%d", even[j++]);
    printf("\n");
    odd.clear();
    even.clear();
  }
}
