#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-8, oo = 1e9;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    vector<int> a, b;
    for (auto &i : s) {
      if ((i - '0') % 2)
        a.push_back(i - '0');
      else
        b.push_back(i - '0');
    }
    vector<int> ans;
    int p0 = 0, p1 = 0;
    while (p0 < a.size() || p1 < b.size()) {
      if (p0 == a.size())
        ans.push_back(b[p1++]);
      else if (p1 == b.size())
        ans.push_back(a[p0++]);
      else if (a[p0] < b[p1])
        ans.push_back(a[p0++]);
      else
        ans.push_back(b[p1++]);
    }
    for (int &i : ans) cout << i;
    cout << '\n';
  }
  return 0;
}
