#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string str;
  while (n--) {
    queue<char> s1, s2;
    cin >> str;
    for (int i = 0; i < str.size(); i++)
      if (str[i] & 1)
        s1.push(str[i]);
      else
        s2.push(str[i]);
    queue<char> ans;
    while (!s1.empty() && !s2.empty()) {
      if (s1.front() < s2.front()) {
        ans.push(s1.front());
        s1.pop();
      } else {
        ans.push(s2.front());
        s2.pop();
      }
    }
    while (!ans.empty()) {
      cout << ans.front();
      ans.pop();
    }
    while (!s1.empty()) {
      cout << s1.front();
      s1.pop();
    }
    while (!s2.empty()) {
      cout << s2.front();
      s2.pop();
    }
    cout << endl;
  }
  return 0;
}
