#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 5;
int a[N], b[N];
int main() {
  int t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    int n = 0, m = 0;
    for (int i = 0; i < s.size(); i++) {
      if ((s[i] - '0') % 2)
        a[n++] = s[i] - '0';
      else
        b[m++] = s[i] - '0';
    }
    int i = 0, j = 0;
    while (i < n || j < m) {
      if (i == n) {
        cout << b[j];
        j++;
      } else if (j == m) {
        cout << a[i];
        i++;
      } else if (a[i] < b[j]) {
        cout << a[i];
        i++;
      } else {
        cout << b[j];
        j++;
      }
    }
    puts("");
  }
  return 0;
}
