#include<bits/stdc++.h>
using namespace std;
 
#define ll long long
#define ld long double
#define pb push_back
#define fi first
#define se second
#define ins insert
#define sz(x) (long long)x.size()
#define all(x) x.begin(),x.end()
#define mod 1000000007

void solve()
{   
    ll n;
    cin>>n;
    vector<ll> a(n, 0);
    for(ll i=0;i<n;i++)
        cin>>a[i];
    vector<ll> odd, even;
    for(ll i=0;i<n;i++)
    {
        if(a[i]%2==1)
            odd.pb(a[i]);
        else 
            even.pb(a[i]);
    }
    ll len1 = odd.size();
    ll len2 = even.size();
    for(ll i=0;i<len1;i++)
        cout<<odd[i]<<" ";
    for(ll i=0;i<len2;i++)
        cout<<even[i]<<" ";
    cout<<'\n';
    return;
} 

int main()
{
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll t=1;
    cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}