#include<bits/stdc++.h>
using namespace std;
const int N=2e5+100;
typedef long long ll;
typedef pair<int,int>PII;
int main(){
	int T;
	scanf("%d",&T);
	while(T--){
		int n;
		scanf("%d",&n);
		vector<int>a;
		vector<int>b;
		for(int i=1;i<=n;i++){
			int xx;
			scanf("%d",&xx);
			if(xx&1)a.push_back(xx);
			else b.push_back(xx);
		} 
		for(int i=0;i<a.size();i++){
			printf("%d ",a[i]);
		}
		for(int i=0;i<b.size();i++){
			printf("%d ",b[i]);
		}
		cout<<endl;
	}
} 