LogiQuest

296. Transpose a Matrix

EasyMatrix

Print the transpose of the r×c matrix (rows become columns).

Input format

Line 1: r c Next r lines: c integers

Output format

c lines of r integers.

Example 1

Input

2 3
1 2 3
4 5 6

Output

1 4
2 5
3 6

Example 2

Input

1 1
7

Output

7

Constraints

1 ≤ r, c ≤ 500

Read input from standard input and print the answer to standard output. Your code is judged against 5 test cases, most of them hidden.

Loading the MyLoginn IDE…