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