#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int N, M;
  cin >> N >> M;
  int Mn = min(N, M);
  int Mx = max(N, M);
  if (Mn == 1 && Mx == 2)
    cout << "-1\n";
  else if (Mn == 1 && Mx == 3)
    cout << "-1\n";
  else if (Mn == 2 && Mx == 2)
    cout << "-1\n";
  else {
    deque<int> E, O;
    int arr_01[N][M];
    for (int x = 1; x <= N * M; x++) {
      if (x & 1)
        O.push_back(x);
      else
        E.push_back(x);
    }
    sort(O.rbegin(), O.rend());
    for (int x = 0; x < N; x++) {
      for (int y = 0; y < M; y++) {
        if (!E.empty()) {
          arr_01[x][y] = E[0];
          E.pop_front();
        } else {
          set<int> Ng;
          if (x - 1 >= 0) Ng.insert(arr_01[x - 1][y]);
          if (y - 1 >= 0) Ng.insert(arr_01[x][y - 1]);
          for (int z = 0; z < O.size(); z++) {
            if (!Ng.count(O[z] - 1) && !Ng.count(O[z] + 1)) {
              arr_01[x][y] = O[z];
              O.erase(O.begin() + z);
              break;
            }
          }
        }
      }
    }
    for (int x = 0; x < N; x++) {
      for (int y = 0; y < M; y++) {
        cout << arr_01[x][y] << " ";
      }
      cout << "\n";
    }
    cout << "\n";
  }
  return 0;
}
