#include <bits/stdc++.h>
using namespace std;
#define qc ios::sync_with_stdio(0)
#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
typedef pair<int, int> Pair;
vector<int>j;
vector<int>o;

int main() {
	qc, cin.tie(0);
	int t;
	cin >> t;
	while (t--) {
		j.clear(), o.clear();
		int n;
		cin >> n;
		while (n--) {
			int tt;
			cin >> tt;
			if (tt % 2 == 0)
				o.pb(tt);
			else
				j.pb(tt);
		}
		for (auto it : j)
			cout << it << " ";
		for (auto it : o)
			cout << it << " ";
		cout << "\n";
	}
}