#include<stdio.h>
int main() {
int row, column, Array[100][100] = {};
while (scanf("%d%d",&row,&column)!=EOF) {
for (int i = 0; i < row; i++) {
for (int j = 0; j < column; j++) {
scanf("%d",&Array[i][j]);
}
}
for (int i = 0; i < column; i++) { //row與column調換順序
for (int j = 0; j < row; j++) {
printf("%d ", Array[j][i]); //注意是Array[j][i],不是Array[i][j]
}
printf("\n");
}
}
return 0;
}