#include<bits/stdc++.h>
#include <sys/types.h>
using namespace std;
int main(){
    ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
    int t;
    cin>>t;
    while(t--){
    int n;
    cin>>n;
    vector<int>j,o;
    while(n--){
        int i;
        cin>>i;
        if(i%2==0)o.push_back(i);
        else j.push_back(i);
    }
    sort(o.begin(),o.end());
    sort(j.begin(),j.end());
    o.insert(o.end(),j.begin(),j.end());
    for(auto &it:o)cout<<it<<' ';
    cout<<'\n';
    }
}

先把奇数和偶数分别存起来,排完序再合并