#include<stdio.h> |
#include<string> |
#include<math.h> |
#include<stdlib.h> |
#include<set> |
#include<bitset> |
#include<map> |
#include<vector> |
#include<string.h> |
#include<algorithm> |
#include<iostream> |
#include<queue> |
#include<sstream> |
#define SZ(X) ((int)(X).size()) |
#define ALL(X) (X).begin(), (X).end() |
#define REP(I, N) for (int I = 0; I < (N); ++I) |
#define REPP(I, A, B) for (int I = (A); I < (B); ++I) |
#define REPC(I, C) for (int I = 0; (C); ++I) |
#define CASET int ___t, case_n = 1; cin>>___t; while (___t-- > 0) |
#define MP make_pair |
#define PB push_back |
#define MS0(X) memset((X), 0, sizeof((X))) |
#define MS1(X) memset((X), -1, sizeof((X))) |
#define LEN(X) strlen(X) |
#define F first |
#define S second |
using namespace std; |
#define SIZE 1000 |
int main(){ |
freopen ( "a.in" , "r" , stdin); |
freopen ( "a.out" , "w" , stdout); |
CASET{ |
cout<< "Case #" <<case_n++<< ":" ; |
int n; |
cin>>n; |
int a[1001]; |
int b[1001]; |
int whi[1001]; |
int t; |
int aa=0,bb=0; |
REP(i,n) |
{ |
cin>>t; |
if (t&1){a[aa++]=t;whi[i]=1;} |
else {b[bb++]=t;whi[i]=0;} |
} |
sort(a,a+aa); |
sort(b,b+bb); |
aa=0; |
REP(i,n) |
{ |
if (whi[i]&1) |
{ |
cout<< " " <<a[aa++]; |
} |
else cout<< " " <<b[--bb]; |
} |
cout<<endl; |
} |
return 0; |
} |