#include<stdio.h>
int main()
{
int n, m;
scanf("%d%d", &n, &m);
int arr[10][10] = { 0 };
for (int i = 0; i < n; i++)
{
for (int p = 0; p < m; p++)
{
scanf("%d", &arr[i][p]);
}
}
for (int i = 0; i < m; i++)
{
for (int p = 0; p < n; p++)
{
printf("%d ", arr[p][i]);
}
printf("\n");
}
return 0;
}
int main()
{
int n, m;
scanf("%d%d", &n, &m);
int arr[10][10] = { 0 };
for (int i = 0; i < n; i++)
{
for (int p = 0; p < m; p++)
{
scanf("%d", &arr[i][p]);
}
}
for (int i = 0; i < m; i++)
{
for (int p = 0; p < n; p++)
{
printf("%d ", arr[p][i]);
}
printf("\n");
}
return 0;
}