#include <bits/stdc++.h>
const int N = 1000100;
const int INF = 0x3f3f3f3f;
int a[N];
int mark[N];
char s1[N];
char s2[N];
using namespace std;
int main() {
  long long n, m, i, j, k, t = 1;
  cin >> t;
  for (int cas = 1; cas <= t; cas++) {
    string s;
    cin >> s;
    int len = s.size();
    int pos1 = 0;
    int pos2 = 0;
    for (int i = 0; i < len; i++) {
      if ((s[i] - '0') % 2)
        s1[pos1++] = s[i];
      else
        s2[pos2++] = s[i];
    }
    int i = 0, j = 0;
    while (i < pos1 || j < pos2) {
      if (i >= pos1) {
        cout << s2[j++];
      } else if (j >= pos2) {
        cout << s1[i++];
      } else if (s1[i] <= s2[j]) {
        cout << s1[i++];
      } else
        cout << s2[j++];
    }
    cout << endl;
  }
  return 0;
}
