#include <bits/stdc++.h>
using namespace std;
const long long init = 1e9 + 7;
const long long N = 1e5 + 7;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    int n = s.length();
    vector<int> v1, v2;
    for (int i = 0; i < n; ++i) {
      int x = s[i] - '0';
      if (x % 2 == 0)
        v1.push_back(x);
      else
        v2.push_back(x);
    }
    vector<int> ans;
    int i = 0, j = 0;
    int n1 = v1.size(), n2 = v2.size();
    while (i < n1 || j < n2) {
      if (i == n1) {
        ans.push_back(v2[j]), ++j;
        continue;
      }
      if (j == n2) {
        ans.push_back(v1[i]), ++i;
        continue;
      }
      if (v1[i] < v2[j])
        ans.push_back(v1[i]), ++i;
      else
        ans.push_back(v2[j]), ++j;
    }
    for (int i = 0; i < ans.size(); ++i) cout << ans[i];
    cout << endl;
  }
  return 0;
}
