using namespace std;
#include<bits/stdc++.h>

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll long long int
#define nl "\n"
#define forf(i,a,n) for(ll i=a;i<=n;i++)
#define forb(i,b,n) for(ll i=b;i>=n;i--)
#define pb push_back
#define vll vector<ll>
#define all(qw) qw.begin(),qw.end()
#define read(vec) ll qwe;cin>>qwe;vec.pb(qwe)
#define pll pair<ll,ll>
#define vpll vector<pll>
#define ff first
#define ss second
#define mp make_pair
#define sll set<ll>
#define inset(sett) ll qwer;cin>>qwer;sett.insert(qwer);

ll hcf(ll a, ll b)
{
	if (b==0)return a;
	return hcf(b, a % b);
}

ll lcm(ll a,ll b)
{
    return (a*b)/hcf(a,b);
}

bool isprime(ll n) {
	if(n==1) return false;
    for (ll i=2;i*i<=n;++i){if(n%i==0) return false;}
    return true;
}

void onlinejudge(){
	#ifndef ONLINE_JUDGE
  freopen("Input.txt", "r", stdin);
  freopen("Output.txt", "w", stdout);
  #endif // ONLINE_JUDGE
}
  
               //SOLVE

void solve(){
   ll n;
   cin>>n;
   ll a[n];
   forf(i,0,n-1) cin>>a[i];
   forf(i,0,n-1){
   	   if(a[i]%2) cout<<a[i]<<" ";
   }
   forf(i,0,n-1){
   	  if(a[i]%2==0) cout<<a[i]<<" ";
   }
   cout<<nl;
}

int main(){  // Change the approach
  onlinejudge();
  //fastio
  ll ttt;ttt=1;
  cin>>ttt;
  while(ttt--) solve();
return 0;
}

// CHECK FOR EXTREME CASES AND ZEROS;