#include<bits/stdc++.h>
using namespace std;
const int N = 15,M = 15;
int mat[N][M];
int n,m,cou = 1;
void dfs(int x,int y){
mat[x][y] = cou;
cou++;
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};
for(int i = 0;i < 4;i++){
int tx = x + dx[i];
int ty = y + dy[i];
if(tx < 1 || tx > n || ty < 1 || ty > m) continue;
if(mat[tx][ty] != 0) continue;
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++){
printf("%3d",mat[i][j]);
}
cout << endl;
}
return 0;
}