/*
 * 
 * 
 * Copyright 2021 Tanishk <tanishktonk>
 * ........ ;)
 * 
 *
 * 
 */
 
#include <bits/stdc++.h>
#define ll long long int
#define fr(i,n) for(i=0;i<n;i++)
#define rng(i,a,b) for(i=a;i<b;i++)
#define T long long int T;cin>>T;while(T--)
#define ain(a,n) for(int zzz=0;zzz<n;zzz++){cin>>a[zzz];}
#define aout(a,n) for(int zzz=0;zzz<n;zzz++){cout<<a[zzz]<<' ';}cout<<"\n";
#define All(v) v.begin(),v.end()
#define dbg(v) cerr<<">-- "<<#v<<" = "<<v<<"\n";
#define PB push_back
#define MP make_pair
#define N "\n"
const ll inf = (1e9+3);
const int M97 = ((int)1e9+7);
using namespace std;

typedef vector<int> Vi;
typedef pair<int,int> Pii;
typedef pair<int,Pii> Piii;

ll i,j,k;

void solve()
{
	int n;
	cin >> n;
	Vi v(n);
	ain(v,n)
	sort(All(v),[](int a,int b)->bool{return (a&1) > (b&1);});
	aout(v,n)
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	
	T solve();
	
    return 0;
}
