#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
const int mod = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  if (n * m == 1) {
    cout << 1 << endl;
    return 0;
  }
  if (m + n < 5) {
    cout << -1 << endl;
    return 0;
  }
  int a = 1, b = (n * m) / 2 + 1;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if ((i + j) % 2) {
        cout << a << " ";
        a++;
      } else {
        cout << b << " ";
        b++;
      }
    }
    cout << endl;
  }
}
