#include <bits/stdc++.h>
using namespace std;
int n, j, s, hm, hal;
int ans[1000001], pdw[1000001];
int a[101][101];
int main() {
  int k, i, j, n, m;
  cin >> n >> m;
  if ((n == 1) && (m == 1))
    cout << 1;
  else if ((n == 2) && (m == 2))
    cout << -1;
  else if (((n == 1) && (m < 4)) || ((m == 1) && (n < 4)))
    cout << -1;
  else if ((n == 1) && (m == 4))
    cout << "3 1 4 2";
  else if ((m == 1) && (n == 4))
    printf("3\n1\n4\n2\n");
  else {
    int count = 1;
    for (int i = 0; i < n; ++i) {
      for (int j = 1 - (i % 2); j < m; j += 2) a[i][j] = count, ++count;
    }
    for (int i = 0; i < n; ++i) {
      for (int j = (i % 2); j < m; j += 2) a[i][j] = count, ++count;
    }
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < m; ++j) cout << a[i][j] << ' ';
      cout << endl;
    }
  }
}
