//轉至矩陣不用先放基底,直接改變print的順序即可
#include<iostream>
using namespace std;
int main() {
int row, column, Array[100][100] = {};
while (cin >> row >> column) {
for (int i = 0; i < row; i++) {
for (int j = 0; j < column; j++) {
cin >> Array[i][j];
}
}
for (int i = 0; i < column; i++) { //row與column調換順序
for (int j = 0; j < row; j++) {
cout << Array[j][i] << " "; //注意是Array[j][i],不是Array[i][j]
}
cout << endl;
}
}
return 0;
}