#include <bits/stdc++.h>
using namespace std;
int main() {
  int T;
  cin >> T;
  while (T--) {
    deque<int> dq;
    string s;
    vector<int> od, ev;
    cin >> s;
    vector<int> ans;
    for (int i = 0; i < s.size(); ++i)
      if (s[i] % 2 == 0)
        ev.push_back(s[i] - '0');
      else
        od.push_back(s[i] - '0');
    int j = 0, i = 0;
    int n = od.size(), m = ev.size();
    if (n == 0) {
      for (auto e : ev) cout << e;
      cout << endl;
      continue;
    }
    if (m == 0) {
      for (auto e : od) cout << e;
      cout << endl;
      continue;
    }
    while (i < n || j < m) {
      if (od[i] < ev[j] && i < n || j == m)
        ans.push_back(od[i++]);
      else
        ans.push_back(ev[j++]);
    }
    for (auto e : ans) cout << e;
    cout << endl;
  }
}
