#include <bits/stdc++.h>
using namespace std;
int dx[] = {-1, 1, 0, 0, -1, 1, -1, 1};
int dy[] = {0, 0, -1, 1, -1, 1, 1, -1};
const int oo = 2e9;
const int N = 1e6;
int t;
string s;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> t;
  while (t--) {
    cin >> s;
    queue<int> odd;
    vector<int> ev;
    for (char c : s) {
      int x = c - '0';
      if (x & 1)
        odd.push(x);
      else
        ev.push_back(x);
    }
    for (int x : ev) {
      while (!odd.empty() && odd.front() < x) {
        cout << odd.front();
        odd.pop();
      }
      cout << x;
    }
    while (!odd.empty()) {
      cout << odd.front();
      odd.pop();
    }
    cout << "\n";
  }
  return 0;
}
