#include<bits/stdc++.h>
using namespace std;
int n,m,k;
int a[10][10]={0};
int fx[4]={0,1,0,-1};
int fy[4]={1,0,-1,0};
void dfs(int x,int y){
	k++;
	a[x][y]=k;
	for(int i=0;i<=3;i++){
		int tx=x+fx[i];
		int ty=y+fy[i];
		if(tx>=1&&tx<=n&&ty>=1&&ty<=m&&a[tx][ty]==0){
			dfs(tx,ty);
		}
	}
}
int main(){
    cin>>n>>m;
    dfs(1,1);
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
    	   cout<<setw(3)<<a[i][j];
        }
		cout<<endl;	
    }
	return 0;
}
/**************************************************************
	Problem: 1586
	User: zengdongxin
	Language: C++
	Result: Accepted
	Time:49 ms
	Memory:2072 kb
****************************************************************/