#include <bits/stdc++.h>
using namespace std;
long long n, ar[200010], m, z, ans, a, b, c, d, e, f, er[200010], chan0, chan1,
    le0, le1, chan, le, t;
string s;
vector<int> ch, l;
int main() {
  cin >> t;
  while (t--) {
    cin >> s;
    chan = 0;
    le = 0;
    for (int i = s.size() - 1; i >= 0; i--) {
      if ((s[i] - '0') % 2 == 0) {
        ch.push_back(s[i] - '0');
        chan++;
      }
      if ((s[i] - '0') % 2 == 1) {
        l.push_back(s[i] - '0');
        le++;
      }
    }
    while (l.size() > 0) {
      while (ch.size() > 0 && l.back() >= ch.back()) {
        cout << ch.back();
        ch.pop_back();
      }
      cout << l.back();
      l.pop_back();
    }
    while (ch.size() > 0) {
      cout << ch.back();
      ch.pop_back();
    }
    cout << "\n";
  }
}
