Showing:
Handle Score
@Ibrahim Nash 5765
@akhayrutdinov 5111
@mb1973 4993
@Quandray 4944
@saiujwal13083 4506
@sanjay05 3762
@marius_valentin_dragoi 3516
@sushant_a 3459
@verma_ji 3341
@KshamaGupta 3318
Form coils in a matrix
Medium Accuracy: 49.77% Submissions: 669 Points: 4

Given a positive integer n that represents dimensions of a 4n x 4n matrix with values from 1 to 4*n*4n filled from left to right and top to bottom. Your task is to form two coils from matrix and print the coils.

Examples:

Input  : n = 1;
Output : Coil 1 : 10 6 2 3 4 8 12 16
Coil 2 : 7 11 15 14 13 9 5 1
Explanation : Matrix is
1  2  3  4
5  6  7  8
9  10 11 12
13 14 15 16


Input:
The first line of input contains an integer T denoting the no of test cases. Then T test cases follow. Each test case contains an integer n.

Output:
For each test case output two lines where line 1 contains the space separated values of the coil1 and line 2 contains space separated values of the coil2. The coil 1 is the coil whose starting element is the greatest.

Constraints:
1<=T<=10
1<=n<=20

Example:
Input:

1
1
Output:
10 6 2 3 4 8 12 16
7 11 15 14 13 9 5 1