#include <bits/stdc++.h>
using namespace std;
void __print(long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }
template <typename T, typename V>
void __print(const pair<T, V> &x) {
  cerr << '{';
  __print(x.first);
  cerr << ',';
  __print(x.second);
  cerr << '}';
}
template <typename T>
void __print(const T &x) {
  long long f = 0;
  cerr << '{';
  for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
  cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cerr << ", ";
  _print(v...);
}
inline long long GCD(long long x, long long y) {
  long long r = x % y;
  while (r) {
    x = y;
    y = r;
    r = x % y;
  }
  return y;
}
const long long N = 1e6 + 69;
bool vis[N];
signed main() {
  long long n, m;
  cin >> n >> m;
  if (n == 1 && m == 1) {
    cout << 1 << '\n';
    return 0;
  }
  if (n == 2 && m == 4) {
    cout << "1 5 2 6 " << '\n';
    cout << "7 3 8 4 " << '\n';
    return 0;
  }
  if (n == 4 && m == 2) {
    cout << "7 1" << '\n';
    cout << "3 5" << '\n';
    cout << "8 2" << '\n';
    cout << "4 6" << '\n';
    return 0;
  }
  if (n == 3 && m == 3) {
    cout << "1 3 5" << '\n';
    cout << "7 9 2" << '\n';
    cout << "4 6 8" << '\n';
    return 0;
  }
  if (n == 1 && m == 4) {
    cout << "3 1 4 2" << '\n';
    return 0;
  }
  if (n == 4 && m == 1) {
    cout << 3 << '\n' << 1 << '\n' << 4 << '\n' << 2 << '\n';
    return 0;
  }
  if (n == 2 && m == 3) {
    cout << "3 6 2" << '\n';
    cout << "5 1 4" << '\n';
    return 0;
  }
  if (n == 3 && m == 2) {
    cout << "5 3" << '\n' << "1 6" << '\n' << "4 2" << '\n';
    return 0;
  }
  if (n == 1 || m == 1) {
    if (n <= 3 && m <= 3) {
      cout << -1;
      return 0;
    }
  }
  if (n <= 2 && m <= 2) {
    cout << -1;
    return 0;
  }
  long long a[n + 2][m + 2];
  for (long long i = 0; i <= n + 1; i++)
    for (long long j = 0; j <= m + 1; j++) a[i][j] = -1;
  if (n == 1 || m == 1) {
    long long x = 1;
    for (long long i = 1; i <= n; i++) {
      for (long long j = 1; j <= m; j++) {
        if (x > m * n) {
          x = 2;
        }
        a[i][j] = x;
        x += 2;
      }
    }
    for (long long i = 1; i <= n; i++) {
      for (long long j = 1; j <= m; j++) {
        cout << a[i][j] << " ";
      }
      cout << '\n';
    }
    return 0;
  }
  a[1][1] = 1;
  vis[1] = 1;
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= m; j++) {
      if (a[i][j] != -1) continue;
      set<long long> s;
      s.insert(a[i - 1][j] - 1);
      s.insert(a[i - 1][j] + 1);
      s.insert(a[i][j - 1] - 1);
      s.insert(a[i][j - 1] + 1);
      s.insert(a[i + 1][j] - 1);
      s.insert(a[i + 1][j] + 1);
      s.insert(a[i][j + 1] - 1);
      s.insert(a[i][j + 1] + 1);
      ;
      for (long long k = 1; k <= m * n; k++) {
        if (!vis[k] && s.find(k) == s.end()) {
          a[i][j] = k;
          vis[k] = 1;
          break;
        }
      }
    }
  }
  long long var = a[n][m];
  long long cnt = 0;
  for (long long i = 1; i <= m * n; i++) {
    if (!vis[i]) {
      cnt++;
      var = i;
      break;
    }
  }
  if (cnt == 0) {
    for (long long i = 1; i <= n; i++) {
      for (long long j = 1; j <= m; j++) {
        cout << a[i][j] << " ";
      }
      cout << '\n';
    }
    return 0;
  }
  a[n][m] = a[1][1];
  a[1][1] = var;
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= m; j++) {
      cout << a[i][j] << " ";
    }
    cout << '\n';
  }
  return 0;
  return 0;
}
