int main() {
int n, m;
scanf("%d %d", &n, &m);
int val[m][n];
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
scanf("%d ", &val[j][i]);
}
}
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
printf("%d ", val[i][j]);
}
printf("\n");
}
return 0;
}