#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, len, i, j;
  string s;
  stack<char> a, b;
  cin >> t;
  while (t--) {
    cin >> s;
    len = s.length();
    for (i = len - 1; i >= 0; i--)
      if ((s[i] - '0') % 2)
        a.push(s[i]);
      else
        b.push(s[i]);
    while (a.size() && b.size()) {
      if (a.top() - '0' > b.top() - '0') {
        cout << b.top();
        b.pop();
      } else {
        cout << a.top();
        a.pop();
      }
    }
    while (a.size()) {
      cout << a.top();
      a.pop();
    }
    while (b.size()) {
      cout << b.top();
      b.pop();
    }
    cout << endl;
  }
  return 0;
}
