#include <bits/stdc++.h>
using namespace std;
template <class T>
bool mini(T &a, T b) {
  return a > b ? (a = b, true) : false;
}
template <class T>
bool maxi(T &a, T b) {
  return a < b ? (a = b, true) : false;
}
void insert(string &s, int pos1, int pos2) {
  char t = s[pos2];
  for (int i = pos2; i > pos1; i--) s[i] = s[i - 1];
  s[pos1] = t;
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.precision(10);
  cout << fixed;
  int test;
  cin >> test;
  while (test--) {
    string s;
    cin >> s;
    vector<vector<int> > f(2);
    for (char c : s) {
      f[(c - '0') % 2].push_back(c - '0');
    }
    vector<int> ans;
    vector<int> cur(2, 0);
    while (1) {
      if (cur[0] == f[0].size() || cur[1] == f[1].size()) break;
      if (f[0][cur[0]] < f[1][cur[1]])
        ans.push_back(f[0][cur[0]++]);
      else
        ans.push_back(f[1][cur[1]++]);
    }
    for (; cur[0] < f[0].size(); cur[0]++) ans.push_back(f[0][cur[0]]);
    for (; cur[1] < f[1].size(); cur[1]++) ans.push_back(f[1][cur[1]]);
    for (int v : ans) cout << v;
    cout << "\n";
  }
}
