#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 10;
int main() {
  int t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    int i;
    char a[N], b[N];
    int cnt1 = 0, cnt2 = 0;
    for (i = 0; i < s.size(); i++) {
      int tmp = s[i] - '0';
      if (tmp % 2 == 0)
        b[cnt2++] = tmp;
      else
        a[cnt1++] = tmp;
    }
    string res = "";
    int j;
    for (i = 0, j = 0; i < cnt1 && j < cnt2;) {
      if (a[i] < b[j]) {
        res += a[i] + '0';
        i++;
      } else {
        res += b[j] + '0';
        j++;
      }
    }
    if (i == cnt1 && j < cnt2) {
      for (int k = j; k < cnt2; k++) res += b[k] + '0';
    } else if (j == cnt2 && i < cnt1) {
      for (int k = i; k < cnt1; k++) res += a[k] + '0';
    }
    cout << res << endl;
  }
}
