#include <bits/stdc++.h>
using namespace std;
const int N = 1000002 + 1;
const int MOD = 1000000007;
const long long MAX = 10000000000;
const int oo = 1e9;
int t;
char tmp[N];
string ans = "";
queue<char> od, ev;
int main() {
  cin >> t;
  while (t--) {
    scanf("%s", tmp);
    ans = "";
    int n = strlen(tmp);
    for (int i = 0; i < n; ++i) {
      int md = (tmp[i] - '0') % 2;
      if (md == 1) {
        od.push(tmp[i]);
      } else {
        ev.push(tmp[i]);
      }
    }
    while (od.size() && ev.size()) {
      if (od.front() < ev.front()) {
        ans += od.front();
        od.pop();
      } else {
        ans += ev.front();
        ev.pop();
      }
    }
    while (od.size()) {
      ans += od.front();
      od.pop();
    }
    while (ev.size()) {
      ans += ev.front();
      ev.pop();
    }
    printf("%s\n", ans.c_str());
  }
  return 0;
}
