#include <bits/stdc++.h>
using namespace std;
const int MAX_S = 100;
bool ok = true;
int a[MAX_S][MAX_S];
bool s;
void swap(int &a, int &b) {
  int temp = a;
  a = b;
  b = temp;
}
int main() {
  int n, m;
  cin >> n >> m;
  if (n > m) {
    swap(n, m);
    s = true;
  } else
    s = false;
  if (n == 1) {
    if (m == 1)
      a[0][0] = 1;
    else if (m < 4)
      ok = false;
    else if (m == 4) {
      a[0][0] = 2;
      a[0][1] = 4;
      a[0][2] = 1;
      a[0][3] = 3;
    } else {
      int now = 1;
      for (int i = 0; i < m; i += 2) a[0][i] = now++;
      for (int i = 1; i < m; i += 2) a[0][i] = now++;
    }
  } else {
    if (m <= 2)
      ok = false;
    else {
      int now = 1;
      for (int i = 1; i >= 0; --i) {
        for (int j = 0; j < n; ++j)
          for (int k = i ^ (j % 2); k < m; k += 2) a[j][k] = now++;
      }
    }
  }
  if (!ok)
    cout << -1 << endl;
  else {
    if (s) swap(n, m);
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < m; ++j) cout << (s ? a[j][i] : a[i][j]) << ' ';
      cout << endl;
    }
  }
  return 0;
}
