#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1000000007
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    // look for test cases:
    
    int t;
    cin>>t;
    while (t--)
    {
        int n;
        cin>>n;
        vector<int> a(n);
        for (int i=0;i<n;i++)cin>>a[i];
        
        for (int i=0;i<n;i++)
        {
            if (a[i]%2==1)cout<<a[i]<<" ";
        }
        for (int i=0;i<n;i++)
        {
            if (a[i]%2==0)cout<<a[i]<<" ";
        }
        cout<<"\n";
    }
    return 0;
}