#include <bits/stdc++.h>

using namespace std;
struct la{
    int x;
    int y;
}a[2005];
bool cmp(la a,la b)
{
    return a.x>b.x;
}
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int n,m,i,k,sum1=0,sum2=0;
        for(m=0;m<=2000;m++)
        {
            a[m].x=0;a[m].y=0;
        }
        cin>>n;
        for(m=0;m<n;m++)
        {
            cin>>a[m].y;
            if(a[m].y%2!=0)
            {
                sum1++;a[m].x=1;
            }
            else
                sum2++;
        }
        if(sum1==0||sum2==0)
        {
            for(m=0;m<n-1;m++)
                cout<<a[m].y<<" ";
            cout<<a[m].y<<endl;
            continue;
        }
        sort(a,a+n,cmp);
        for(m=0;m<n-1;m++)
            cout<<a[m].y<<" ";
        cout<<a[m].y<<endl;
    }
    return 0;
}
