#include <bits/stdc++.h>

#define ll long long
#define MOD 1000000007
using namespace std;


bool isPalin(string& s) {
	for (int i = 0; i < s.size(); i++) {
		if (s[i] != s[s.size() - 1 - i]) {
			return false;
		}
	}
	return true;
}

bool isIncr(vector<ll>& a) {
	for (int i = 0; i < a.size() - 1; i++) {
		if (a[i] > a[i + 1]) {
			return false;
		}
	}
	return true;
}

void solved(ll n) {

}

int main() {

	ios_base::sync_with_stdio(false);
	ll t, r,c, n;
	cin >> t;

	while (t--) {
		cin >> n;
		vector<ll> a(n);

		for (int i = 0; i < n; i++) {
			cin >> a[i];
		}

		vector<ll> odd;
		vector<ll> even;

		for (int i = 0; i < n; i++) {
			if (a[i] % 2 == 0) {
				even.push_back(a[i]);
			}
			else {
				odd.push_back(a[i]);
			}
		}

		for (int i = 0; i < odd.size(); i++) {
			cout << odd[i] << " ";
		}

		for (int i = 0; i < even.size(); i++) {
			cout << even[i] << " ";
		}

		cout << endl;
	}
	return 0;
}