#include<iostream>
using namespace std;
int main()
{
int N = 5;
int i=0,j,k=1,a[N][N];
for(i=0;i<N;i++)
{
for(j = 0;j<N;j++)
{
a[i][j] =k;
k++;
}
}
for(i=N-1;i>=0;i--)
{
for(j = 0;j<N;j++)
{
cout<<a[i][j]<<" ";
}
cout<<endl;
}
return 0;
}