#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <vector>
#include <stack>
#include <map>
#include <set>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <bitset>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef set<int>::iterator ssii;
#define Cmp(a, b) memcmp(a, b, sizeof(b))
#define Cpy(a, b) memcpy(a, b, sizeof(b))
#define Set(a, v) memset(a, v, sizeof(a))
#define debug(x) cout << #x << ": " << x << endl
#define _forS(i, l, r) for(set<int>::iterator i = (l); i != (r); i++)
#define _rep(i, l, r) for(int i = (l); i <= (r); i++)
#define _for(i, l, r) for(int i = (l); i < (r); i++)
#define _forDown(i, l, r) for(int i = (l); i >= r; i--)
#define debug_(ch, i) printf(#ch"[%d]: %d\n", i, ch[i])
#define debug_m(mp, p) printf(#mp"[%d]: %d\n", p->first, p->second)
#define debugS(str) cout << "dbg: " << str << endl;
#define debugArr(arr, x, y) _for(i, 0, x) { _for(j, 0, y) printf("%c", arr[i][j]); printf("\n"); }
#define _forPlus(i, l, d, r) for(int i = (l); i + d < (r); i++)
#define lowbit(i) (i & (-i))
#define MPR(a, b) make_pair(a, b)
pair<int, int> crack(int n) {
int st = sqrt(n);
int fac = n / st;
while (n % st) {
st += 1;
fac = n / st;
}
return make_pair(st, fac);
}
inline ll qpow(ll a, int n) {
ll ans = 1;
for(; n; n >>= 1) {
if(n & 1) ans *= 1ll * a;
a *= a;
}
return ans;
}
// ================================================ //
const int maxn = 100 + 10;
int n, m;
int ans[maxn][maxn];
bool vis[maxn][maxn];
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
bool valid(int x, int y) {
return 0 <= x && x <= n - 1 && 0 <= y && y <= m - 1;
}
void solve() {
int x = 0, y = 0, dir = 0;
_rep(i, 1, n * m) {
int nx = x + dx[dir], ny = y + dy[dir];
if(vis[nx][ny] || !valid(nx, ny)) {
dir = (dir + 1) % 4;
nx = x + dx[dir];
ny = y + dy[dir];
}
vis[x][y] = 1;
ans[x][y] = i;
x = nx;
y = ny;
}
_for(i, 0, n) {
_for(j, 0, m) printf("%d ", ans[i][j]);
printf("\n");
}
//printf("\n");
}
void init() {
memset(ans, 0, sizeof(ans));
memset(vis, 0, sizeof(vis));
}
int main() {
freopen("input.txt", "r", stdin);
cin >> n >> m;
init();
solve();
}