#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 5;
string arr[100];
vector<int> a, b;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    a.clear();
    b.clear();
    string s;
    cin >> s;
    for (int i = 0; i < s.size(); ++i) {
      int x = s[i] - '0';
      if (x & 1)
        a.push_back(x);
      else
        b.push_back(x);
    }
    string ans = "";
    int i, j;
    for (i = 0, j = 0; i < a.size() && j < b.size();) {
      if (a[i] < b[j])
        ans += '0' + a[i++];
      else
        ans += '0' + b[j++];
    }
    while (i < a.size()) ans += '0' + a[i++];
    while (j < b.size()) ans += '0' + b[j++];
    printf("%s\n", ans.c_str());
  }
  return 0;
}
