GR - Grand Reward

Grand is one of the best companies every month, The manager chooses the best employee and rewards him. This month there are 4 employees do the same effort Sameh, Ameen, Shafeek and Atef but the manager will give reward to one only, He got a good idea

Let's say that the 4 employees will stand in someway like that every employee in one of the four sides east (Sameh), north (Ameen), west (Shafik) and south (Atef) then, there's a square matrix of  width and height N×N among them first element in matrix will start with 1 then next element increase by 1 from left to right and from top to down until N×N like that

                Ameen
                1 2 3
  Sameh  4 5 6  Shafeek
                7 8 9
                 Atef

then let's rotate the matrix T turns 90 degrees clockwise per turn and the winner is the person who the sum of his side is the greatest 

For example let's say that T=4 and N=3,

des

Atef wins because the sum of his side is 7+8+9=24 and it's the greatest

It's your job now create a program that do this job.

Input

Two integers the size of the matrix N (3 ≤ N ≤ 25), and the number of turns (1 ≤ T ≤ 10^9).

Output

The final result of the matrix and the employee who will get the reward (Sameh, Ameen, Shafeek, Atef).

Example

Input:
3 4

Output:
Atef
1 2 3
4 5 6
7 8 9
Input:
4 3

Output:
Shafeek
4 8 12 16
3 7 11 15
2 6 10 14
1 5 9 13

Added by:atef
Date:2016-03-10
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64 GOSU JS-MONKEY
Resource:http://codeforces.com/group/2GQNxUCcIL/contest/202218/problem/G

hide comments
2016-03-12 13:53:01 sai krishna
Matrix rotation is ok,but how to determine who is the winnner(not mentioned in question)

Last edit: 2016-03-12 13:53:37
2016-03-12 06:18:35
beware of spaces between numbers,cost me 3 wa
2016-03-11 20:40:51 atef
sahil
output
Atef
1 2 3
4 5 6
7 8 9
your out put
Atef
123
456
789
2016-03-11 19:49:36
wa in judge 12...why? showing correct outputs for cases u provied in comments too

Last edit: 2016-03-11 19:59:46
2016-03-11 19:38:04 atef
andrewt try this input man 8 17 :)
2016-03-11 17:00:57
thank you :)

Last edit: 2016-03-12 06:43:36
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.