#include <bits/stdc++.h>
using namespace std;
int T;
int a[300100], n;
int atp;
queue<int> q0, q1;
string s;
void solve() {
  cin >> s;
  n = s.size();
  for (int i = 0; i < n; i++) {
    a[i + 1] = s[i] - '0';
  }
  for (int i = 1; i <= n; i++) {
    if (a[i] % 2 == 0)
      q0.push(a[i]);
    else
      q1.push(a[i]);
  }
  atp = 0;
  while (q0.size() && q1.size()) {
    if (q0.front() < q1.front()) {
      a[++atp] = q0.front();
      q0.pop();
    } else {
      a[++atp] = q1.front();
      q1.pop();
    }
  }
  while (q0.size()) {
    a[++atp] = q0.front();
    q0.pop();
  }
  while (q1.size()) {
    a[++atp] = q1.front();
    q1.pop();
  }
  for (int i = 1; i <= n; i++) cout << a[i];
  cout << endl;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> T;
  while (T--) solve();
  return 0;
}
