#include <bits/stdc++.h>
long l, a[105][105] = {0}, n, m, i, j, k, tot, base;
int main() {
  scanf("%ld %ld\n", &n, &m);
  if (n == 1 && m == 1)
    printf("1");
  else if (n <= 2 && m <= 2)
    printf("-1");
  else if ((n == 1 && m == 3) || (n == 3 && m == 1))
    printf("-1");
  else if (n == 2 && m == 3)
    printf("3 6 2\n5 1 4\n");
  else if (n == 3 && m == 2)
    printf("3 5\n6 1\n2 4\n");
  else if (n == 3 && m == 3)
    printf("1 3 5\n7 9 2\n4 6 8\n");
  else {
    if (n < m) {
      for (base = 0, i = 1; i <= n; i++) {
        for (tot = 0, j = 2; j <= m; j += 2) a[i][++tot] = j + base;
        for (j = 1; j <= m; j += 2) a[i][++tot] = j + base;
        base += m;
      }
    } else {
      for (base = 0, j = 1; j <= m; j++) {
        for (tot = 0, i = 2; i <= n; i += 2) a[++tot][j] = i + base;
        for (i = 1; i <= n; i += 2) a[++tot][j] = i + base;
        base += n;
      }
    }
    for (i = 1; i <= n; i++)
      for (j = 1; j <= m; j++) printf("%ld%c", a[i][j], j == m ? '\n' : ' ');
  }
  return 0;
}
