z,zz=input,lambda:list(map(int,z().split()))
zzz=lambda:[int(i) for i in stdin.readline().split()]
szz,graph,mod,szzz=lambda:sorted(zz()),{},10**9+7,lambda:sorted(zzz())
from string import *
from re import *
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f
from bisect import bisect as bs
from bisect import bisect_left as bsl
from itertools import accumulate as ac
def lcd(xnum1,xnum2):return (xnum1*xnum2//gcd(xnum1,xnum2))
def prime(x):
    p=ceil(x**.5)+1
    for i in range(2,p):
        if (x%i==0 and x!=2) or x==0:return 0
        
    return 1
def dfs(u,visit,graph):
    visit[u]=True
    for i in graph[u]:
        if not visit[i]:
            dfs(i,visit,graph)

###########################---Test-Case---#################################
"""
5 2

8 2 1 3

9 3 8

100 64 50 25 75
42

128 96 88 80 52 7



"""
###########################---START-CODING---##############################

num=int(z())

for _ in range(  num):
    n=int(z())
    l=zzz()
    odd=[]
    even=[]
    mx=-1
    for i in l:
        if i%2!=0:
            odd.append(i)
        else:
            even.append(i)
        mx=max(i,mx)
    if mx%2==0:
        print(*(even+odd))
    else:
        print(*(odd+even))
    
    
    
        
        
        
