#include<bits/stdc++.h>
using namespace std;
int main()
{
  int t;
  cin >> t;
  while (t--)
  {
    multiset<int>s, p;
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
      int a;
      cin >> a;
      if (a % 2 == 0)
      {
        s.insert(a);
      }
      else
      {
        p.insert(a);
      }
    }
    for (auto x : p)
    {
      cout << x << " ";
    }
    for (auto x : s)
    {
      cout << x << " ";
    }

    cout << endl;
  }
}