#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define fr(m) for(int i=0; i<m; i++)
#define fro(m) for(int i=1; i<m; i++)
#define frj(m) for(int j=0; j<m; j++)
#define frr(n) for(int i=n; i>=0; i--)
#define pb push_back
#define pf push_front
#define orr ||
#define nll '\n'
#define nl cout<<'\n'
#define mod 1000000007
#define sci(n) scanf("%d", &n)
#define scl(n) scanf("%lld", &n)
#define pri(n) printf("%d\n", n)
#define prl(n) printf("%lld\n", n)
#define prc(n) printf("%c\n", n)
#define yes cout<<"YES"<<nll
#define no cout<<"NO"<<nll
#define ff first
#define ss second
#define inp freopen("input.txt", "r", stdin)
#define outp freopen("output.txt", "w", stdout)
#define debug(arr,n) for(int i=0; i<n; i++) cout<<arr[i]<<" "; nl
#define debugr(arr,s,e) for(int i=s; i<=e; i++) cout<<arr[i]<<" "; nl
#define debugm(arr,n,m) fr(n){frj(m){cout<<arr[i][j]<<" ";}nl;}
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

int main()
{
	fastio;
	int t, cnt=1;
	cin>>t;
	while(t--){
		ll n;
		cin>>n;
		ll a;
		vector<ll>o,ev;
		fr(n){
			cin>>a;
			if(a&1) o.pb(a);
			else ev.pb(a);
		}
		for(ll b : o) cout<<b<<" ";
		for(ll b : ev) cout<<b<<" ";
		nl;
	}
    return 0;
}