Kahvei is creating a fun activity for Halloween! His plan consists of an by surface filled with candy. Each cell on the surface will contain a specific character. Since Kahvei is broke saving up, all the candy he has is off-brand. These brands are all distinct alphabet characters like a
and b
.
However, Kahvei realizes that his plan was rotated by degrees counterclockwise! Since Halloween is approaching and he has no time to rotate his plan, he gives you his plan in hopes that you can help him. He wants you to give him his original plan.
Constraints
where is a multiple of .
Each letter on the plan is guaranteed to be a lowercase character from a
to z
inclusive.
Input Specification
The first line of input will contain an integer , followed by integer .
The next lines will contain characters, separated by spaces, representing the candy brand.
Output Specification
The output should consist of lines with digits on each line. This will be the rotated array.
Sample Input 1
4 90
a b c d
q w e r
z x c v
a s d f
Sample Output 1
a z q a
s x w b
d c e c
f v r d
Sample Input 2
3 180
n e e
w o l
l a h
Sample Output 2
h a l
l o w
e e n
Comments