#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
long long mod = 2000000771;
const long double PI = (long double)(3.1415926535897932384626433832795);
void mergeSort(int arr[], int l, int r) {
  if (l < r) {
    int m = l + (r - l) / 2;
    if ((arr[m] > arr[m + 1]) && ((arr[m] % 2) ^ (arr[m + 1] % 2))) {
      swap(arr[m], arr[m + 1]);
    }
    mergeSort(arr, l, m);
    mergeSort(arr, m + 1, r);
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.precision(3);
  cout << fixed;
  int t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    int n = s.length();
    std::vector<int> odd, even, ans;
    for (auto x : s) {
      if ((x - '0') % 2)
        odd.push_back(x - '0');
      else
        even.push_back(x - '0');
    }
    int i = 0, j = 0;
    while ((i + j) != n) {
      if (i == odd.size()) {
        ans.push_back(even[j]);
        ++j;
      } else if (j == even.size()) {
        ans.push_back(odd[i]);
        ++i;
      } else {
        if (odd[i] > even[j]) {
          ans.push_back(even[j]);
          ++j;
        } else {
          ans.push_back(odd[i]);
          ++i;
        }
      }
    }
    for (auto x : ans) {
      cout << x;
    }
    cout << endl;
  }
}
