#include <bits/stdc++.h>
using ll = int64_t;
using namespace std;
int main() {
  using namespace std;
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  int t;
  string s;
  cin >> t;
  for (int _ = 0, _Len = (t); _ < _Len; ++_) {
    cin >> s;
    deque<int> odd, even;
    for (auto c : s) {
      int x = c - '0';
      if (x % 2 == 1)
        odd.emplace_back(x);
      else
        even.emplace_back(x);
    }
    string ans = "";
    while (!odd.empty() && !even.empty()) {
      if (odd.front() < even.front()) {
        ans += to_string(odd.front());
        odd.pop_front();
      } else {
        ans += to_string(even.front());
        even.pop_front();
      }
    }
    for (auto x : odd) ans += to_string(x);
    for (auto x : even) ans += to_string(x);
    cout << ans << "\n";
  }
  return 0;
}
