#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxint = 2147483646;
const int minint = -2147483646;
const long long maxlll = 9223372036854775805;
const long long minlll = -9223372036854775805;
const ll mody = 1000000007;
template <class T>
ostream& operator<<(ostream& os, vector<T>& v) {
  os << "[";
  for (int i = 0; i < v.size(); i++) {
    os << v[i];
    if (i != v.size() - 1) {
      os << ", ";
    }
  }
  os << "]";
  return os;
}
template <class T, class U>
ostream& operator<<(ostream& os, unordered_map<T, U>& dt) {
  os << "{";
  for (auto i = dt.begin(); i != dt.end(); i++) {
    os << i->first << ": " << i->second;
    auto temp = i;
    temp++;
    if (temp != dt.end()) {
      os << ", ";
    }
  }
  os << "}";
  return os;
}
template <class T, class U>
ostream& operator<<(ostream& os, pair<T, U>& dt) {
  os << "<" << dt.first << "," << dt.second << ">";
  return os;
}
template <typename T, unsigned int N>
typename std::enable_if<!std::is_same<T, char>::value, std::ostream&>::type
operator<<(std::ostream& os, const T (&a)[N]) {
  for (size_t i = 0; i < N; ++i) {
    os << a[i];
    if (i < N - 1) {
      cout << " ";
    }
  }
  os << endl;
  return os;
}
template <class T, class U>
ostream& operator<<(ostream& os, map<T, U>& dt) {
  os << "{";
  for (auto i = dt.begin(); i != dt.end(); i++) {
    os << i->first << ": " << i->second;
    auto temp = i;
    temp++;
    if (temp != dt.end()) {
      os << ", ";
    }
  }
  os << "}";
  return os;
}
template <class T, class U>
ostream& operator<<(ostream& os, multimap<T, U>& dt) {
  os << "{";
  for (auto i = dt.begin(); i != dt.end(); i++) {
    os << i->first << ": " << i->second;
    auto temp = i;
    temp++;
    if (temp != dt.end()) {
      os << ", ";
    }
  }
  os << "}";
  return os;
}
template <class T>
ostream& operator<<(ostream& os, set<T>& dt) {
  os << "{";
  for (auto i = dt.begin(); i != dt.end(); i++) {
    os << *i;
    auto temp = i;
    temp++;
    if (temp != dt.end()) {
      os << ", ";
    }
  }
  os << "}";
  return os;
}
template <class T>
ostream& operator<<(ostream& os, multiset<T>& dt) {
  os << "{";
  for (auto i = dt.begin(); i != dt.end(); i++) {
    os << *i;
    auto temp = i;
    temp++;
    if (temp != dt.end()) {
      os << ", ";
    }
  }
  os << "}";
  return os;
}
template <class T>
ostream& operator<<(ostream& os, stack<T>& dt) {
  stack<T> t;
  os << "[";
  while (!dt.empty()) {
    T temp = dt.top();
    os << temp;
    dt.pop();
    t.push(temp);
    if (!dt.empty()) {
      os << ", ";
    }
  }
  os << "]";
  while (!t.empty()) {
    T temp = t.top();
    dt.push(temp);
    t.pop();
  }
  return os;
}
template <class T>
ostream& operator<<(ostream& os, queue<T>& dt) {
  queue<T> t;
  os << "[";
  while (!dt.empty()) {
    T temp = dt.front();
    os << temp;
    dt.pop();
    t.push(temp);
    if (!dt.empty()) {
      os << ", ";
    }
  }
  os << "]";
  while (!t.empty()) {
    T temp = t.front();
    dt.push(temp);
    t.pop();
  }
  return os;
}
template <class T>
ostream& operator<<(ostream& os, list<T>& dt) {
  os << "[";
  for (auto i = dt.begin(); i != dt.end(); i++) {
    os << *i;
    auto temp = i;
    temp++;
    if (temp != dt.end()) {
      os << ", ";
    }
  }
  os << "]";
  return os;
}
template <class T>
ostream& operator<<(ostream& os, priority_queue<T>& dt) {
  queue<T> t;
  os << "[";
  while (!dt.empty()) {
    T temp = dt.top();
    os << temp;
    dt.pop();
    t.push(temp);
    if (!dt.empty()) {
      os << ", ";
    }
  }
  os << "]";
  while (!t.empty()) {
    T temp = t.front();
    dt.push(temp);
    t.pop();
  }
  return os;
}
template <class T = ll>
vector<T> clist(int n) {
  std::vector<T> v;
  while (n--) {
    T k;
    cin >> k;
    v.push_back(k);
  }
  return v;
}
template <class T = ll, class U = ll>
vector<pair<T, U>> clist2(int n) {
  std::vector<pair<T, U>> v;
  while (n--) {
    T a;
    U b;
    cin >> a >> b;
    pair<T, U> p(a, b);
    v.push_back(p);
  }
  return v;
}
vector<char> cstrtv(string& s) {
  vector<char> v;
  for (int i = 0; i < s.size(); i++) {
    v.push_back(s[i]);
  }
  return v;
}
template <class T>
struct freq {
  map<T, vector<int>> m;
  int n;
  freq(vector<T>& s) {
    n = s.size();
    for (int i = 0; i < s.size(); i++) {
      if (m.find(s[i]) == m.end()) {
        vector<int> v;
        m[s[i]] = v;
      }
      m[s[i]].push_back(i);
    }
  }
  freq(string& s) {
    n = s.size();
    for (int i = 0; i < s.size(); i++) {
      if (m.find(s[i]) == m.end()) {
        vector<int> v;
        m[s[i]] = v;
      }
      m[s[i]].push_back(i);
    }
  }
  int operator[](T ind) {
    if (m.find(ind) == m.end()) {
      return 0;
    }
    return m[ind].size();
  }
  int mode() {
    int maxfrq = 0;
    T maxel;
    for (auto it = m.begin(); it != m.end(); it++) {
      if (it->second.size() > maxfrq) {
        maxfrq = it->second.size();
        maxel = it->first;
      }
    }
    return maxel;
  }
  int first(T el) {
    if (m[el].size() != 0) {
      return m[el][0];
    }
    return n;
  }
  int last(T el) {
    if (m[el].size() != 0) {
      return m[el][m[el].size() - 1];
    }
    return -1;
  }
};
template <class T>
int maxind(vector<T>& v) {
  int maxi = 0;
  for (int i = 1; i < v.size(); i++) {
    maxi = (v[maxi] < v[i]) ? i : maxi;
  }
  return maxi;
}
template <class T>
T maxel(vector<T>& v) {
  return v[maxind(v)];
}
template <class T>
int minind(vector<T>& v) {
  int mini = 0;
  for (int i = 1; i < v.size(); i++) {
    mini = (v[mini] > v[i]) ? i : mini;
  }
  return mini;
}
template <class T>
T minel(vector<T>& v) {
  return v[minind(v)];
}
template <class T>
vector<ll> partialsums(vector<T>& v) {
  vector<ll> ps(v.size());
  ps[0] = v[0];
  for (int i = 1; i < v.size(); i++) {
    ps[i] = ps[i - 1] + v[i];
  }
  return ps;
}
template <class T>
ll sumy(vector<T>& v) {
  ll s = 0;
  for (int i = 0; i < v.size(); i++) {
    s += v[i];
  }
  return s;
}
template <class T>
vector<int> pminin(vector<T>& v) {
  vector<int> ret = {0};
  int curi = 0;
  for (int i = 1; i < v.size(); i++) {
    if (v[i] < v[curi]) {
      curi = i;
    }
    ret.push_back(curi);
  }
  return ret;
}
template <class T>
vector<int> pmaxin(vector<T>& v) {
  vector<int> ret = {0};
  int curi = 0;
  for (int i = 1; i < v.size(); i++) {
    if (v[i] > v[curi]) {
      curi = i;
    }
    ret.push_back(curi);
  }
  return ret;
}
template <class T>
vector<T> pmin(vector<T>& v) {
  vector<T> ret;
  vector<int> temp = pminin(v);
  for (int i = 0; i < temp.size(); i++) {
    ret.push_back(v[temp[i]]);
  }
  return ret;
}
template <class T>
vector<T> pmax(vector<T>& v) {
  vector<T> ret;
  vector<int> temp = pmaxin(v);
  for (int i = 0; i < temp.size(); i++) {
    ret.push_back(v[temp[i]]);
  }
  return ret;
}
int ind(int i, int n) {
  if (i % n >= 0) {
    return i % n;
  }
  return (i % n) + n;
}
struct graph {};
set<int> divisors(int n) {
  set<int> s;
  for (int i = 1; i <= sqrt(n); i++) {
    if (n % i == 0) {
      if (n / i == i) {
        s.insert(i);
      } else {
        s.insert(i);
        s.insert(n / i);
      }
    }
  }
  return s;
}
freq<int> pf(int n) {
  vector<int> s;
  while (n % 2 == 0) {
    s.push_back(2);
    n = n / 2;
  }
  for (int i = 3; i <= sqrt(n); i = i + 2) {
    while (n % i == 0) {
      s.push_back(i);
      n = n / i;
    }
  }
  if (n > 2) {
    s.push_back(n);
  }
  return freq<int>(s);
}
bool isprime[1];
void seive(int n) {
  for (int i = 0; i < n + 1; i++) {
    isprime[i] = true;
    ;
  }
  isprime[0] = false;
  isprime[1] = false;
  for (int i = 0; i < n + 1; i++) {
    if (isprime[i]) {
      for (int j = 2 * i; j < n + 1; j += i) {
        isprime[j] = false;
      }
    }
  }
}
ll modexp(ll n, ll e) {
  if (e == 0) {
    return 1;
  } else {
    if (e % 2) {
      return (n * (modexp(n, e - 1))) % mody;
    } else {
      ll res = modexp(n, e / 2);
      return (res * res) % mody;
    }
  }
}
string mergeArrays(string& arr1, string& arr2, int n1, int n2) {
  string arr3(n1 + n2, '0');
  int i = 0, j = 0, k = 0;
  while (i < n1 && j < n2) {
    if (arr1[i] < arr2[j])
      arr3[k++] = arr1[i++];
    else
      arr3[k++] = arr2[j++];
  }
  while (i < n1) arr3[k++] = arr1[i++];
  while (j < n2) arr3[k++] = arr2[j++];
  return arr3;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    string o;
    string e;
    string s;
    cin >> s;
    for (int i = 0; i < s.size(); i++) {
      char x = s[i];
      if ((x - '0') % 2) {
        o.push_back(x);
      } else {
        e.push_back(x);
      }
    }
    cout << mergeArrays(o, e, o.size(), e.size()) << endl;
  }
}
