#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    deque<int> a, b;
    for (int i = 0; i < s.size(); i++) {
      if ((s[i] - '0') % 2 == 1)
        a.push_back(s[i] - '0');
      else
        b.push_back(s[i] - '0');
    }
    while (1) {
      if (a.size() + b.size() == 0) break;
      if (a.size() != 0 && b.size() != 0) {
        if (a[0] < b[0]) {
          cout << a[0];
          a.pop_front();
        } else {
          cout << b[0];
          b.pop_front();
        }
      }
      if (a.size() == 0) {
        while (!b.empty()) {
          cout << b[0];
          b.pop_front();
        }
      }
      if (b.size() == 0) {
        while (!a.empty()) {
          cout << a[0];
          a.pop_front();
        }
      }
    }
    cout << '\n';
  }
}
