#include <bits/stdc++.h>
using namespace std;
const int MAX = 109;
int n, m, t1, t2 = 1;
int main() {
  cin >> n >> m;
  if (n == m && n == 1) return cout << 1, 0;
  if (m + n < 5) return cout << -1, 0;
  t1 = n * m / 2 + 1;
  for (int i = 0; i < n; i++, cout << '\n')
    for (int j = 0; j < m; j++)
      if ((i + j) % 2 == 0)
        cout << t1 << " ", t1++;
      else
        cout << t2 << " ", t2++;
}
