#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using uint = unsigned int;
template <typename T>
inline void read(T& x) {
  x = 0;
  long long f = 1;
  register char c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-') f = -1;
  for (; isdigit(c); c = getchar()) x = (x << 1) + (x << 3) + (c & 15);
  x *= f;
}
template <typename T>
inline void print(T x) {
  if (!x) {
    putchar('0');
    return;
  }
  static long long st[105];
  if (x < 0) putchar('-'), x = -x;
  long long tp = 0;
  while (x) st[++tp] = x % 10, x /= 10;
  while (tp) putchar(st[tp--] + '0');
}
template <typename T>
inline void print(T x, char c) {
  print(x);
  putchar(c);
}
template <typename T, typename... Args>
inline void read(T& x, Args&... args) {
  read(x);
  read(args...);
}
template <typename T>
inline void sort(vector<T>& v) {
  sort(v.begin(), v.end());
  return;
}
template <typename T>
inline void unique(vector<T>& v) {
  sort(v);
  v.erase(unique(v.begin(), v.end()), v.end());
}
template <typename T>
inline void cmax(T& x, T y) {
  if (x < y) x = y;
  return;
}
template <typename T>
inline void cmin(T& x, T y) {
  if (x > y) x = y;
  return;
}
const long long Mod = LLONG_MAX;
inline long long QP(long long x, long long y) {
  long long ans = 1;
  for (; y; y >>= 1, x = (x * x) % Mod)
    if (y & 1) ans = (ans * x) % Mod;
  return ans;
}
template <typename T>
inline T gcd(T x, T y) {
  if (y == 0) return x;
  return gcd(y, x % y);
}
template <typename T>
inline T lcm(T x, T y) {
  return x * y / gcd(x, y);
}
template <typename T>
inline void mul(T& x, T y) {
  x = 1LL * x * y;
  if (x >= Mod) x %= Mod;
}
template <typename T>
inline void add(T& x, T y) {
  if ((x += y) >= Mod) x -= Mod;
}
template <typename T>
inline void sub(T& x, T y) {
  if ((x -= y) < 0) x += Mod;
}
signed main() {
  long long T;
  read(T);
  while (T--) {
    string s;
    getline(cin, s);
    vector<long long> od, ev, ans;
    for (auto x : s)
      if (x - '0' & 1)
        od.push_back(x - '0');
      else
        ev.push_back(x - '0');
    reverse(ev.begin(), ev.end());
    reverse(od.begin(), od.end());
    long long st1 = ev.size(), st2 = od.size();
    while (st1 || st2) {
      if (!st2 || (st1 && ev[st1 - 1] < od[st2 - 1])) {
        ans.push_back(ev[--st1]);
      } else {
        ans.push_back(od[--st2]);
      }
    }
    for (long long x : ans) print(x);
    putchar('\n');
  }
  return 0;
}
