#include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
const int maxn = 3e5 + 10;
const int mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;
char s[maxn];
queue<int> q, qq;
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    scanf("%s", s);
    int len = strlen(s);
    for (int i = 0; i < len; i++) {
      if ((s[i] - '0') % 2 == 0)
        q.push((s[i] - '0'));
      else
        qq.push(s[i] - '0');
    }
    while (!q.empty() || !qq.empty()) {
      int a = inf, b = inf;
      if (!q.empty()) a = q.front();
      if (!qq.empty()) b = qq.front();
      if (a < b)
        printf("%d", a), q.pop();
      else
        printf("%d", b), qq.pop();
    }
    printf("\n");
  }
  return 0;
}
