#include <bits/stdc++.h>
using namespace std;
int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  int t;
  cin >> t;
  for (; t > 0; --t) {
    string s;
    cin >> s;
    vector<int> v;
    for (int i = 0; i < s.size(); ++i) {
      v.push_back((int)s[i] - (int)'0');
    }
    int n = v.size();
    vector<vector<int>> d(2, vector<int>());
    for (int i = 0; i < n; ++i) {
      d[v[i] % 2].push_back(v[i]);
    }
    int i = 0, j = 0;
    while (i < d[0].size() && j < d[1].size()) {
      cout << min(d[0][i], d[1][j]);
      if (d[0][i] < d[1][j]) {
        i++;
      } else {
        j++;
      }
    }
    while (i < d[0].size()) {
      cout << d[0][i];
      i++;
    }
    while (j < d[1].size()) {
      cout << d[1][j];
      j++;
    }
    cout << endl;
  }
}
