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

int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        vector<int>odd,even;
        for(int i=0;i<n;i++)
        {
            int xx;
            cin>>xx;
            if(xx%2==0) even.push_back(xx);
            else odd.push_back(xx);
        }
        for(int i=0;i<odd.size();i++) cout<<odd[i]<<" ";
        for(int i=0;i<even.size();i++) cout<<even[i]<<" ";
        cout<<endl;
    }
}