/* IMPORTANT: Multiple classes and nested static classes are supported */
/*
* uncomment this if you want to read input.
//imports for BufferedReader*/
import java.io.BufferedReader;
import java.io.InputStreamReader;
//import for Scanner and other utility classes
import java.util.*;
class TestClass {
/*
* Read input from stdin and provide input before running
* Use either of these methods for input
//BufferedReader*/
Scanner s
= new Scanner
(System.
in); int count,temp;
int t
= Integer.
parseInt(br.
readLine());
for(int i = 0; i<t; i++){
int nod
= Integer.
parseInt(br.
readLine()); line = br.readLine();
int[] tasks = new int[nod];
int[] noo = new int[nod];
for(int j = 0; j<nod; j++){
tasks
[j
] = Integer.
parseInt(st.
nextToken()); temp = tasks[j];
count = 0;
while(temp!=0){
temp = temp & temp-1;
count++;
}
noo[j] = count;
}
for(int b=0;b<nod;b++){
}
for(int x=0; x<nod-1;x++){
for(int y= 0;y<nod-1;y++){
if(noo[y] > noo[y+1]){
temp = noo[y];
noo[y] = noo[y+1];
noo[y+1] = temp;
temp = tasks[y];
tasks[y] = tasks[y+1];
tasks[y+1] = temp;
}
}
}
for(int z = 0;z<nod;z++){
if(z!=nod-1){
}
}
}
/*
//Scanner
Scanner s = new Scanner(System.in);
int N = s.nextInt();
for (int i = 0; i < N; i++) {
System.out.println("hello world");
}
System.out.println("Hello World!");*/
}
}
LyogSU1QT1JUQU5UOiBNdWx0aXBsZSBjbGFzc2VzIGFuZCBuZXN0ZWQgc3RhdGljIGNsYXNzZXMgYXJlIHN1cHBvcnRlZCAqLwoKLyoKICogdW5jb21tZW50IHRoaXMgaWYgeW91IHdhbnQgdG8gcmVhZCBpbnB1dC4KLy9pbXBvcnRzIGZvciBCdWZmZXJlZFJlYWRlciovCmltcG9ydCBqYXZhLmlvLkJ1ZmZlcmVkUmVhZGVyOwppbXBvcnQgamF2YS5pby5JbnB1dFN0cmVhbVJlYWRlcjsKCi8vaW1wb3J0IGZvciBTY2FubmVyIGFuZCBvdGhlciB1dGlsaXR5ICBjbGFzc2VzCmltcG9ydCBqYXZhLnV0aWwuKjsKCgpjbGFzcyBUZXN0Q2xhc3MgewogICAgcHVibGljIHN0YXRpYyB2b2lkIG1haW4oU3RyaW5nIGFyZ3NbXSApIHRocm93cyBFeGNlcHRpb24gewogICAgICAgIC8qCiAgICAgICAgICogUmVhZCBpbnB1dCBmcm9tIHN0ZGluIGFuZCBwcm92aWRlIGlucHV0IGJlZm9yZSBydW5uaW5nCiAgICAgICAgICogVXNlIGVpdGhlciBvZiB0aGVzZSBtZXRob2RzIGZvciBpbnB1dAoKICAgICAgICAvL0J1ZmZlcmVkUmVhZGVyKi8KICAgICAgICBCdWZmZXJlZFJlYWRlciBiciA9IG5ldyBCdWZmZXJlZFJlYWRlcihuZXcgSW5wdXRTdHJlYW1SZWFkZXIoU3lzdGVtLmluKSk7CiAgICAgICAgU3RyaW5nIGxpbmU7CiAgICAgICAgU2Nhbm5lciBzID0gbmV3IFNjYW5uZXIoU3lzdGVtLmluKTsKICAgICAgICBpbnQgY291bnQsdGVtcDsKICAgICAgICBpbnQgdCA9IEludGVnZXIucGFyc2VJbnQoYnIucmVhZExpbmUoKSk7CiAgICAgICAgCiAgICAgICAgZm9yKGludCBpID0gMDsgaTx0OyBpKyspewogICAgICAgIAlpbnQgbm9kID0gSW50ZWdlci5wYXJzZUludChici5yZWFkTGluZSgpKTsKICAgICAgICAJbGluZSA9IGJyLnJlYWRMaW5lKCk7CiAgICAgICAgCWludFtdIHRhc2tzID0gbmV3IGludFtub2RdOwogICAgICAgIAlpbnRbXSBub28gPSBuZXcgaW50W25vZF07CiAgICAgICAgCVN0cmluZ1Rva2VuaXplciBzdCA9IG5ldyBTdHJpbmdUb2tlbml6ZXIobGluZSwiICIpOwogICAgICAgIAlmb3IoaW50IGogPSAwOyBqPG5vZDsgaisrKXsKICAgICAgICAJCXRhc2tzW2pdID0gSW50ZWdlci5wYXJzZUludChzdC5uZXh0VG9rZW4oKSk7CiAgICAgICAgCQl0ZW1wID0gdGFza3Nbal07CiAgICAgICAgCQljb3VudCA9IDA7CiAgICAgICAgCQl3aGlsZSh0ZW1wIT0wKXsKICAgICAgICAJCQl0ZW1wID0gdGVtcCAmIHRlbXAtMTsKICAgICAgICAJCQljb3VudCsrOwogICAgICAgIAkJfQogICAgICAgIAkJbm9vW2pdID0gY291bnQ7CiAgICAgICAgCX0KICAgICAgICAJZm9yKGludCBiPTA7Yjxub2Q7YisrKXsKICAgICAgICAJCVN5c3RlbS5vdXQucHJpbnQobm9vW2JdKyIgIik7CiAgICAgICAgCX0KICAgICAgICAJU3lzdGVtLm91dC5wcmludGxuKCk7CiAgICAgICAgCWZvcihpbnQgeD0wOyB4PG5vZC0xO3grKyl7CiAgICAgICAgCQlmb3IoaW50IHk9IDA7eTxub2QtMTt5KyspewogICAgICAgIAkJCWlmKG5vb1t5XSA+IG5vb1t5KzFdKXsKICAgICAgICAJCQkJdGVtcCA9IG5vb1t5XTsKICAgICAgICAJCQkJbm9vW3ldID0gbm9vW3krMV07CiAgICAgICAgCQkJCW5vb1t5KzFdID0gdGVtcDsKICAgICAgICAJCQkJCiAgICAgICAgCQkJCXRlbXAgPSB0YXNrc1t5XTsKICAgICAgICAJCQkJdGFza3NbeV0gPSB0YXNrc1t5KzFdOwogICAgICAgIAkJCQl0YXNrc1t5KzFdID0gdGVtcDsKICAgICAgICAJCQl9CiAgICAgICAgCQl9CiAgICAgICAgCX0KICAgICAgICAJZm9yKGludCB6ID0gMDt6PG5vZDt6KyspewogICAgICAgIAkJU3lzdGVtLm91dC5wcmludCh0YXNrc1t6XSk7CiAgICAgICAgCQlpZih6IT1ub2QtMSl7CiAgICAgICAgCQkJU3lzdGVtLm91dC5wcmludCgiICIpOwogICAgICAgIAkJfQogICAgICAgIAl9CiAgICAgICAgCVN5c3RlbS5vdXQucHJpbnRsbigpOwogICAgICAgIH0KCQkvKgogICAgICAgIC8vU2Nhbm5lcgogICAgICAgIFNjYW5uZXIgcyA9IG5ldyBTY2FubmVyKFN5c3RlbS5pbik7CiAgICAgICAgaW50IE4gPSBzLm5leHRJbnQoKTsKCiAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBOOyBpKyspIHsKICAgICAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKCJoZWxsbyB3b3JsZCIpOwogICAgICAgIH0KICAgICAgICAKCiAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKCJIZWxsbyBXb3JsZCEiKTsqLwogICAgfQp9Cg==