#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int t, n, i, j;
  string second;
  cin >> t;
  while (t--) {
    cin >> second;
    vector<int> v1, v2;
    n = second.length();
    for (i = 0; i < n; i++) {
      if ((second[i] - '0') % 2)
        v1.push_back(second[i] - '0');
      else
        v2.push_back(second[i] - '0');
    }
    string ans = "";
    i = j = 0;
    while (i < v1.size() && j < v2.size()) {
      if (v1[i] < v2[j])
        ans += char(v1[i++] + '0');
      else
        ans += char(v2[j++] + '0');
    }
    while (i < v1.size()) ans += char(v1[i++] + '0');
    while (j < v2.size()) ans += char(v2[j++] + '0');
    cout << ans << '\n';
  }
}
