#include <bits/stdc++.h>
using namespace std;
const int dim = 3e5 + 3;
int par[dim], impar[dim];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string sir, raspuns;
  int t, i, j, cif;
  int cate_pare, cate_imp;
  cin >> t;
  while (t--) {
    cin >> sir;
    cate_pare = cate_imp = 0;
    for (i = 0; i < sir.size(); ++i) {
      cif = sir[i] - '0';
      if (cif % 2 == 0) {
        par[cate_pare] = cif;
        ++cate_pare;
      } else {
        impar[cate_imp] = cif;
        ++cate_imp;
      }
    }
    i = j = 0;
    while (i < cate_pare && j < cate_imp) {
      if (par[i] < impar[j]) {
        raspuns += par[i] + '0';
        ++i;
      } else {
        raspuns += impar[j] + '0';
        ++j;
      }
    }
    while (i < cate_pare) {
      raspuns += par[i] + '0';
      ++i;
    }
    while (j < cate_imp) {
      raspuns += impar[j] + '0';
      ++j;
    }
    cout << raspuns << '\n';
    raspuns = "";
  }
  return 0;
}
