#include <iostream>
#include <iomanip>
using namespace std;
int main()
{int n,m,i,j,a[30][30],k=0;
cout<<"n="; cin>>n;
cout<<"m="; cin>>m;
for (i=1;i<=n;i++)
for (j=1;j<=m;j++)
{k++;
if (k%2==1)
{a[i][j]=k*k;
k++;}
}
for (i=1;i<=n;i++)
{for (j=1;j<=m;j++)
cout<<setw(4)<<a[i][j];
cout<<endl;
}
}