#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 10;
char a[maxn];
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    scanf("%s", a);
    int n = strlen(a);
    vector<int> v[2];
    for (int i = 0; a[i]; ++i) {
      v[(a[i] - '0') & 1].push_back(a[i] - '0');
    }
    v[0].push_back(INT_MAX);
    v[1].push_back(INT_MAX);
    int j = 0, k = 0;
    for (int i = 0; i < n; ++i) {
      int x;
      if (v[0][j] < v[1][k])
        x = v[0][j++];
      else
        x = v[1][k++];
      printf("%d", x);
    }
    puts("");
  }
  return 0;
}
