A matrix A of dimension (N,M) has N*M elements in the format of N rows(橫列) and M columns(直行), and thus each element has a pair of index (i, j), where i is less than N, j is less than M, and both are greater or equal to 0. For example, a matrix A of dimension (2, 3) may look like this:
[ 1 3 5 ]
[ 2 4 6 ]
where the element A(0,1) is 3 and A(1, 0) is 2.
In linear algebra, a transpose of a matrix A, which is AT, is to reflect the A over its main diagonal(主對角線). For each element A(i,j), the new location of the element in the AT is (j,i).
In this problem, a matrix A is given, and you are asked to output AT, which is the transpose of A.
The input consists of 2 parts, which present the marix A:
Output is the matrix AT, which should have M rows. All elements in a row should be seperated by a space, and make sure there is no trailing spaces at the end of each line.