#include <bits/stdc++.h>
using namespace std;
int a[300005], b[300005];
int main() {
  ios::sync_with_stdio(false);
  int T;
  cin >> T;
  while (T--) {
    int pos1 = 0, pos2 = 0;
    string s;
    cin >> s;
    int len = s.length();
    for (int i = 0; i < len; i++) {
      int d = s[i] - '0';
      if (d % 2) {
        a[pos1++] = d;
      } else {
        b[pos2++] = d;
      }
    }
    int cur1 = 0, cur2 = 0;
    for (int i = 0; i < len; i++) {
      if (cur1 == pos1)
        cout << b[cur2++];
      else if (cur2 == pos2)
        cout << a[cur1++];
      else if (a[cur1] < b[cur2])
        cout << a[cur1++];
      else
        cout << b[cur2++];
    }
    cout << endl;
  }
  return 0;
}
