#include <bits/stdc++.h>
using namespace std;
template <typename T>
struct FenwickTree {
  T N;
  vector<int> tree;
  void init(int n) {
    N = n;
    tree.assign(n + 1, 0);
  }
  void update(int idx, T val) {
    while (idx <= N) {
      tree[idx] += val;
      idx += idx & -idx;
    }
  }
  void updateMax(int idx, T val) {
    while (idx <= N) {
      tree[idx] = max(tree[idx], val);
      idx += idx & -idx;
    }
  }
  T pref(int idx) {
    T ans = 0;
    while (idx > 0) {
      ans += tree[idx];
      idx -= idx & -idx;
    }
    return ans;
  }
  T rsum(int l, int r) { return pref(r) - pref(l - 1); }
  T prefMax(int idx) {
    T ans = -2e9;
    while (idx > 0) {
      ans = max(ans, tree[idx]);
      idx -= idx & -idx;
    }
    return ans;
  }
};
long long stoii(string s) {
  long long ans = 0;
  for (auto it : s) {
    long long cur = it - '0';
    ans = ans * 10 + cur;
  }
  return ans;
}
struct custom_hash {
  static uint64_t splitmix64(uint64_t x) {
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }
  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM =
        chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);
  }
};
const long long int MOD = 1e9 + 7;
int dx[] = {-1, 0, 1, 0};
int dy[] = {0, 1, 0, -1};
const long long int N = 1e5;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  t = 1;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    vector<int> ev;
    vector<int> od;
    for (int i = 0; i < n; i++) {
      int num;
      cin >> num;
      if (num & 1)
        od.push_back(num);
      else
        ev.push_back(num);
    }
    if (ev.size() == 0 || od.size() == 0) {
      if (ev.size() == 0) {
        sort(od.rbegin(), od.rend());
        for (auto it : od) cout << it << " ";
        ;
      } else {
        sort(ev.rbegin(), ev.rend());
        for (auto it : ev) cout << it << " ";
        ;
      }
      cout << endl;
      continue;
    }
    sort(ev.rbegin(), ev.rend());
    sort(od.rbegin(), od.rend());
    if (ev[0] > od[0]) {
      for (auto it : ev) cout << it << " ";
      ;
      sort(od.begin(), od.end());
      for (auto it : od) cout << it << " ";
      ;
      cout << endl;
    } else {
      for (auto it : od) cout << it << " ";
      ;
      sort(ev.begin(), ev.end());
      for (auto it : ev) cout << it << " ";
      ;
      cout << endl;
    }
  }
}
