#include <bits/stdc++.h>
using namespace std;
const int QQ = 3e5 + 10;
const int maxN = 2e5 + 100;
const int maxM = 3e5 + 10;
const long long oo = 1e18;
const int module = 1e9 + 7;
const long double du = 1e-9;
void doc() {
  freopen(
      "solve"
      ".inp",
      "r", stdin);
  freopen(
      "solve"
      ".out",
      "w", stdout);
}
void Get() {
  string s;
  cin >> s;
  int n = (int)s.size();
  int vl[n];
  for (int i = 0; i < n; i++) vl[i] = s[i] - '0';
  vector<int> a[2];
  for (int i = 0; i < n; i++) a[vl[i] % 2].push_back(vl[i]);
  int L = 0;
  int R = 0;
  vector<int> Res;
  while (L < (int)a[0].size() && R < (int)a[1].size()) {
    if (a[0][L] < a[1][R])
      Res.push_back(a[0][L++]);
    else
      Res.push_back(a[1][R++]);
  }
  while (L < (int)a[0].size()) Res.push_back(a[0][L++]);
  while (R < (int)a[1].size()) Res.push_back(a[1][R++]);
  for (int x : Res) cout << x;
}
void solve() {
  int T;
  cin >> T;
  while (T--) {
    Get();
    cout << '\n';
  }
}
int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(0);
  cin.tie(nullptr);
  cout.tie(nullptr);
  solve();
}
