//package CodeForces;

import java.io.*;
import java.util.*;

public class Main {

    public class Haha {
        /*                     _____                                                             ___
                /\      /\    |     | |   |    /\       /\      /\       /\      /\       /\    |   \     محمد أبوحسن*
               /  \    /  \   |     | |___|   /__\     /  \    /  \     /  \    /  \     /__\   |    \
              /    \  /    \  |     | |   |  /    \   /    \  /    \   /    \  /    \   /    \  |    /
             /      \/      \ |_____| |   | /      \ /      \/      \ /      \/      \ /      \ |___/
         */
    }

    public static class MyScanner {

        BufferedReader br;
        StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

    public static class MyPair {

        int x;
        int y;

        public MyPair(int x, int y) {
            this.x = x;
            this.y = y;
        }
    }

    public static int Fibonacci(int n) {
        int[] a = new int[n + 1];
        a[0] = 0;
        a[1] = 1;
        for (int i = 2; i < a.length; i++) {
            a[i] = a[i - 1] + a[i - 2];
        }
        return a[n];
    }

    public static boolean isprime(int n) {
        for (int i = 2; i * i <= n; i++) {
            if (n % i == 0) {
                return true;
            }
        }
        return false;
    }

    public static int[] addarr(int[] a, int n) {
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        return a;
    }
    
    public static int fact(int n){
        int fact = 1;
        for(int i = 1; i <= n; i++)
            fact *= i;
        return fact;
    }
    
    public static long sumDigit(long n){
        int a = 0;
        while(n != 0){
            a += n%10;
            n /= 10;
        }
        return a;
    }
    
    public static long fastpow(long v,  long p){
        if (p == 0)  return 1;
        if (p == 1)  return v;
        long ans = fastpow(v, p / 2);
        if (p % 2 == 1)  return ans * ans * v;
        else  return ans * ans;
    }
    
    public static MyScanner sc = new MyScanner();
    public static int MOD = 1000000007;
    // __builtin_popcountll(n) <-- c++ // binary count(1) ex. 8 --> 0100 --> 1
    HashSet<Integer> set = new HashSet<>();
    HashMap<Integer, Integer> map = new HashMap<>();
    Random r = new Random();
    ArrayList<Integer> l = new ArrayList<>();
    
    public static void main(String[] args) {
        int t = sc.nextInt();
        while(t-->0){
            int n = sc.nextInt();
            int[] a = new int[n];
            addarr(a, n);
            Arrays.sort(a);
            System.out.print(a[n-1] + " ");
            if(a[n-1]%2 == 0){
                for (int i = n-2; i >= 0; i--) {
                    if(a[i]%2 == 0)
                        System.out.print(a[i] + " ");
                }   
                for (int i = n-2; i >= 0; i--) {
                    if(a[i]%2 != 0)
                        System.out.print(a[i] + " ");
                }
                System.out.println();
            }
            else{
                for (int i = n-2; i >= 0; i--) {
                    if(a[i]%2 != 0)
                        System.out.print(a[i] + " ");
                }
                for (int i = n-2; i >= 0; i--) {
                    if(a[i]%2 == 0)
                        System.out.print(a[i] + " ");
                } 
                System.out.println();
            }
//            if(sum1%2 == 0){
//                System.out.println(n);
//                for (int i = 0; i < n; i++) {
//                    System.out.print(a[i] + " ");
//                }
//                System.out.println("");
//                continue;
//            }
//            sum1--;
//            Arrays.sort(a);
//            if(sum1%2 == 0){n--;
//                System.out.println(n);
//                if(n != 0){
//                    int i = 0;
//                    //if(n%2 != 0) i++;
//                    //System.out.println(i + " " + n);
//                    for (; i < n; i++) {
//                        System.out.print(a[i] + " ");
//                    }
//                    System.out.println("");
//                }
//                continue;
//            }
//            
//            int k = n/2;
//            System.out.println(k);
//            boolean ok = true;
//            boolean ok2 = true;
//            for (int i = k; i < n; i++) {
//                if(a[i] != 1)
//                    ok = false;
//            }
//            for (int i = k; i < n; i++) {
//                if(a[i] != 0)
//                    ok2 = false;
//            }
//            if(ok || ok2){
//                //System.out.println(ok + "    " + ok2);
//                if(n%2 != 0)
//                    System.out.print(0 + " ");
//                for (int i = n%2 != 0 ? k+1 : k; i < (n%2 != 0 ? n-1 : n); i++) {
//                    System.out.print(a[i] + " ");
//                }
//                System.out.println();
//            }
//            else{
//                int r = 0;
//                for (int i = 0; i < k/2; i++) {
//                    System.out.print(a[i] + " ");
//                    r++;
//                }
//                for (int i = n-1; r < k; i--) {
//                    System.out.print(a[i] + " ");
//                    r++;
//                }
//                System.out.println();
//            }
        }
    }
}