Your next assignment from CodeVax is to help develop a COVID-19 vaccine. To do this, you must decode COVID-19's genetic sequence. More specifically, COVID-19's gene sequence is represented by an
Let
r1 c1 r2 c2 x
: Rotate the square subgrid consisting of the points
Given the
Input Specification
The first line of input will contain a positive integer,
The next
The next line will contain a positive integer,
The next
Output Specification
Output COVID-19's genetic sequence after it has been decoded.
Constraints
For all subtasks:
Every number in the grid will be a value in the range
It is guaranteed that
Note that you will NOT be required to pass all the samples to receive points.
Subtask 1 [15%]
Subtask 2 [85%]
Sample Input 1
2
1 2
3 4
1
1 1 2 2 90
Sample Output 1
3 1
4 2
Sample Input 2
4
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
5
1 1 4 4 360
2 2 3 3 -270
1 1 3 3 -90
2 2 4 4 180
3 2 4 3 90
Sample Output 2
3 6 7 4
2 16 15 14
1 8 12 5
13 11 9 10
Comments