#include <bits/stdc++.h>
using namespace std;
string solve() {
  string s;
  cin >> s;
  string odd, even;
  for (char c : s) {
    int x = c - '0';
    if (x % 2 == 0)
      even.push_back(c);
    else
      odd.push_back(c);
  }
  int n = (int)even.size();
  int m = (int)odd.size();
  int i = 0, j = 0;
  string ans;
  while (i < n || j < m) {
    if (i == n)
      ans.push_back(odd[j++]);
    else if (j == m)
      ans.push_back(even[i++]);
    else if (odd[j] < even[i])
      ans.push_back(odd[j++]);
    else
      ans.push_back(even[i++]);
  }
  return ans;
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) cout << solve() << '\n';
  return 0;
}
