#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
	// your code goes here
	ll t;
	cin>>t;
	while(t--)
	{
		ll n;
		cin>>n;
		ll a[n];
		for(ll i=0;i<n;i++)
		{
			cin>>a[i];
		}
		
		for(int i=0;i<n;i++)if(a[i]%2)cout<<a[i]<<" ";
		for(int i=0;i<n;i++)if(a[i]%2==0)cout<<a[i]<<" ";
		cout<<endl;
		
	}
	return 0;
}