P13316 [CodeChef] insm06
NOI
题目描述

Ronak’s class teacher gives him an NxN matrix.
Then, she gives him M numbers. Every number is an angle, the angle by which he has to rotate the matrix in clockwise direction. (The angles are multiples of 90.)
Help him with the task.

Input
First line consists of two numbers N and M.
The following N lines contain N numbers each (representing the matrix).
The next M lines contain one number each, representing the angle by which the matrix is to be rotated.

Output
For M problems, generate M appropriately rotated matrices, each seperated by a new line.

Constraints

1 ≤ N,M ≤ 100

Example
Input:
4 2
1 2 3 4
4 5 6 7
6 8 4 3
8 1 4 7
90
180

Output:
8 6 4 1
1 8 5 2
4 4 6 3
7 3 7 4

7 4 1 8
3 4 8 6
7 6 5 4
4 3 2 1

输入格式

见题面

输出格式

见题面

样例输入
4 2 1 2 3 4 4 5 6 7 6 8 4 3 8 1 4 7 90 180
样例输出
8 6 4 1 1 8 5 2 4 4 6 3 7 3 7 4 7 4 1 8 3 4 8 6 7 6 5 4 4 3 2 1