#include<stdio.h>
int main()
{
int arr[101][101]={};
int direct[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
int x, y, dx, dy;
int i,j,a, n,m,u=1, k=0;
scanf("%d %d",&n,&m);
for(i=0; i<n+2; i++ ) {
for(j=0; j<m+2; j++) {
if(i==0 || j==0 || i==n+1 || j==m+1) {
arr[i][j] = 9;
}
}
}
x = 1;
y = 1;
arr[x][y] = u++;
dx = direct[k][0];
dy = direct[k][1];
for(i=n*m -1; i>0; i--) {
if(arr[x+dx][y+dy] == 0) {
x+=dx;
y+=dy;
arr[x][y] = u++;
}
else {
k++;
k %= 4;
dx = direct[k][0];
dy = direct[k][1];
i--;
}
}
for(i=1;i<=n;i++)
{
for(j=1;j<=m;j++)
{
printf("%d ",arr[i][j]);
}
printf("\n");
}
return 0;
}