#K84247. Comic Book Sorting
Comic Book Sorting
Comic Book Sorting
You are given a collection of comic books with a number of pages. The task is to sort the pages in each comic such that all comics with even-numbered pages come first (sorted in descending order) followed by odd-numbered pages (also in descending order).
For each test case, the first line contains an integer T representing the number of test cases. For each test case, the first number is N, the number of comic books, followed by a line with N integers, each representing the number of pages in a comic book.
The output for each test case should be a single line containing the sorted comic pages separated by spaces.
The sorting order is defined as follows:
- Even-numbered pages are sorted in descending order.
- Odd-numbered pages are sorted in descending order.
- The final order is the even pages followed by the odd pages. </p>
inputFormat
The input is given from standard input in the following format:
T N1 a1 a2 ... aN1 N2 b1 b2 ... bN2 ... NT c1 c2 ... cNT
Here, T denotes the number of test cases. For each test case, the first line contains an integer N (the number of comic books), followed by a line with N space-separated integers representing the number of pages in each comic book.
outputFormat
For each test case, output a single line to standard output containing the sorted comic pages separated by spaces. The even-numbered pages (in descending order) should appear first, followed by the odd-numbered pages (in descending order).
## sample1
5
10 15 20 25 30
30 20 10 25 15
</p>