11715 - I2P_17_EECS_MID_2_1   

Description

(7 points)

Given an n-by-n square matrix A, please calculate the 2-by-2 block-wise transpose of A.
By 2-by-2 block-wise transpose, we mean to compute the transpose of every 2-by-2 block in A. 

For example, if the square matrix A is
1 2 3 4
5 6 7 8
8 7 6 5
4 3 2 1

The result of 2-by-2 block-wise transpose of A is
1 5 3 7
2 6 4 8
8 4 6 2
7 3 5 1

The upper-left block 
1 2
5 6
has been transposed into 
1 5
2 6
and the upper-right block
3 4
7 8
has been transposed into
3 7
4 8
so on and so forth.

Input

The first line contains an integer n, representing the length of A's side. It is guaranteed that 1 < n < 500, and n is always a multiple of 2.

The next n lines represent the n rows of A. Each row contains n integers.

Output

Print the the 2-by-2 block-wise transpose of A.
Remember to add a new line at the end of your answer.

Sample Input  Download

Sample Output  Download

Tags




Discuss