#P370. 【例64.1】 二维数组转置

【例64.1】 二维数组转置

Description

Input an array with nn rows and mm columns, and output its transpose. Specifically,
the number in the ii-th row and jj-th column of the output should be the number in the jj-th row and ii-th column of the input.
$1 \le n \le 20000; 1 \le m \le 20000; 1 \le n * m \le 20000; 1 \le a[i][j] \le 1000$
Note: You cannot declare a two-dimensional array with both dimensions of size 2000020000 (arrays cannot be too large, and the size of a two-dimensional array is the product of its dimensions).
A two-dimensional array is essentially equivalent to a one-dimensional array, so you only need a one-dimensional array of size 2000020000.

Input Format

First line contains two integers nn and mm representing the number of rows and columns of the array.
Next nn lines, each containing mm integers representing the array contents.

Output Format

First line outputs mm and nn. Then output the transpose, consisting of mm rows and nn columns. The number in the ii-th row and jj-th column should be the number in the jj-th row and ii-th column of the input.

Sample

3 2
1 2
3 4
5 6
2 3
1 3 5
2 4 6