P10987 [HackerEarth] amit and pattern
普及
题目描述

Amit has been practicing "pattern printing" problems a lot. To test his ability Jitendra gives him a problem.He tells him to print the given matrix in the diagonal fashion.

Note: Direction of the diagonal is from the upper-right corner to lower-left corner.See sample test cases for more clarification.Imagine you are Amit. Write the code to prove your ability!

Input:

First line contain the values of N and M.

Next N lines contain M space separated numbers.

Output:

Print the given matrix in the diagonal fashion as described.

Constraints:

1 ≤ N,M ≤ 100

0 ≤ element of matrix ≤100

SAMPLE INPUT
3 3
1 2 3
5 6 7
0 1 2

SAMPLE OUTPUT
1
2 5
3 6 0
7 1
2

输入格式

见题面

输出格式

见题面

样例输入
3 3 1 2 3 5 6 7 0 1 2 SAMPLE
样例输出
1 2 5 3 6 0 7 1 2