#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int p = 0;
  int f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    p = p * 10 + ch - '0';
    ch = getchar();
  }
  return p * f;
}
const int N = 3e5 + 10;
int a[N];
char str[N];
vector<int> v0, v1;
int main() {
  int t = read();
  while (t--) {
    scanf("%s", str + 1);
    int len = strlen(str + 1);
    for (int i = 1; i <= len; i++) a[i] = str[i] - '0';
    v0.clear();
    v1.clear();
    for (int i = 1; i <= len; i++)
      if (a[i] & 1)
        v1.push_back(a[i]);
      else
        v0.push_back(a[i]);
    int j0, j1;
    j0 = j1 = 0;
    while (j0 < v0.size() && j1 < v1.size()) {
      if (v0[j0] < v1[j1])
        printf("%d", v0[j0]), j0++;
      else
        printf("%d", v1[j1]), j1++;
    }
    while (j0 < v0.size()) printf("%d", v0[j0]), j0++;
    while (j1 < v1.size()) printf("%d", v1[j1]), j1++;
    printf("\n");
  }
  return 0;
}
