#include <bits/stdc++.h>
using namespace std;
int o[300010];
int e[300010];
int a[300010];
int on, en;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    string no;
    cin >> no;
    for (int i = 0; i < no.size(); i++) {
      o[i] = e[i] = a[i] = 0;
    }
    on = en = 0;
    for (int i = 0; i < no.size(); i++) {
      if ((no[i] - '0') % 2 == 1)
        o[on++] = no[i] - '0';
      else
        e[en++] = no[i] - '0';
    }
    int po = 0, pe = 0, pa = 0;
    while (po < on || pe < en) {
      if (po < on && pe < en) {
        if (o[po] < e[pe])
          a[pa++] = o[po++];
        else
          a[pa++] = e[pe++];
      }
      if (po == on) {
        a[pa++] = e[pe++];
      } else if (pe == en) {
        a[pa++] = o[po++];
      }
    }
    for (int i = 0; i < pa; i++) cout << a[i];
    cout << '\n';
  }
}
