Black Widow is now tired of the black color. As she can’t change her avenger uniform she decides to paint her walls with colorful matrix patterns with numbers and alphabets . After she is a mathematics geek. She asked the painter to paint only an N*N matrices on her wall i.e. she wants only square matrices. To add some creativity she decides to get only two walls painted and the second wall will have the same matrix as in the previous wall after rotating it by 90 degrees.
The painter was weak in Mathematics and Black Widow has to go urgently to save the world. So, she asks you to help the painter while she is out doing the necessary job. You decide to make an application according to which if the painter enters the matrix pattern he made on the wall, the application automatically gives the required matrix pattern for the next wall. But, remember you have to rotate the matrix in place i.e. that is you can’t use another matrix to perform the rotation.
The first line contains the dimension of the matrix pattern, N. And the following N lines contain N space separated integers indicating the values of the matrix pattern made by the painter.
The output contains N lines of N space separated integers Ai indicating the matrix pattern for the next wall.
- 2 ≤ N ≤ 105
- 2 ≤ Ai ≤ 105
Input: 4 1 2 3 4 5 6 7 8 9 1 2 3 3 4 5 6 Output: 3 9 5 1 4 1 6 2 5 2 7 3 6 3 8 4
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, CS2, PAS fpc, PAS gpc, GO, NODEJS, HASK, D, PERL, FORT, ADA, CAML, ICK, BF, ASM, CLPS, ICON, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, JS, ERL, kotlin, PERL6, CLOJ, COB, FS|
Fetching successful submissions