#include<stdio.h>
int main()
{
   int rows, cols;
   scanf("%d %d", &rows, &cols);
   if(rows < 0 || cols < 0)
   {
   printf("Invalid input\n");
   }
   int a[100][100];
   for (int i=0; i < rows; i++)
   for (int j=0; j < cols; j++)
   scanf("%d", &a[i][j]);
   for(int i = rows - 1; i >= 0; i--)
   for (int j = cols - 1; j >= 0; j--)
   printf("%d ",a[i]\n[j]);
   printf("\n");
}