#include <bits/stdc++.h>
using namespace std;

//TO_STRING
template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string& s) {
  return '"' + s + '"';
}

string to_string(char ch){
  string s;
  s += ch;
  return s;
}

string to_string(const char* s) {
  return to_string((string) s);
}

string to_string(bool b) {
  return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}

template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " +
    to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " +
    to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

//DEBUG
void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL //compile with -DLOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;

typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<pi> vpi;
typedef vector<char> vch;
typedef vector<string> vstr;
typedef vector<vi> vvi;
typedef vector<vpi> vvpi;
typedef vector<pll> vpll;
typedef vector<vll> vvll;
typedef vector<vb> vvb;
typedef vector<vvi> vvvi;
typedef vector<vch> vvch;
typedef vector<vstr> vvstr;
typedef vector<ld> vld;
typedef vector<vld> vvld;

#define all(x) x.begin(), x.end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define sz(x) ((ll)x.size())

const int maxn = 2e5 + 5;
const ll mod = 1e9 + 7;
vll fac(maxn), invfac(maxn);

ll expmod(ll x, ll n, ll mod){
  //x ^ n % mod
  if(n == 0) return 1;
  else if(n % 2 == 0){
    ll temp = expmod(x, n / 2, mod);
    return (temp * temp) % mod;
  }
  else{
    return (expmod(x, n - 1, mod) * x) % mod;
  }
}

ll modinv(ll x, ll mod) {
  return expmod(x, mod - 2, mod);
}

void find_fac() {
  fac[0] = 1;
  invfac[0] = 1;

  for (int i = 1; i < maxn; i++) {
    fac[i] = fac[i - 1] * i % mod;
    invfac[i] = invfac[i - 1] * modinv(i, mod) % mod;
  }
}

ll C(int n, int k) {
  if (k > n) return 0;
  else {
    return fac[n] * invfac[k] % mod * invfac[n - k] % mod;
  }
}

void no() {
  cout << "-1\n";
  exit(0);
}

#define rep(i, a, b) for (int i = (int)a; i < (int)b; i++)
#define repi(i, a, b) for (int i = (int)a; i >= (int)b; i--)

void solve() {
  int n, m;
  cin >> n >> m;

  int a = n, b = m;
  if (n > m) swap(n, m);

  if (n == 1 && m == 2 || n == 1 && m == 3 ||
    n == 2 && m == 2) {
    no();
  } else {
    vvi ans(n, vi(m));
    int it = n * m;
    if (it % 2 == 0) it--;
    rep(j, 0, m) {
      rep(i, 0, n) {
        ans[i][j] = it;
        if (it == 1) {
          it = n * m;
          if (it % 2 == 1) it--;
        } else {
          it -= 2;
        }
      }
    }

    if (n == a) {
      rep(i, 0, n) {
        rep(j, 0, m) {
          cout << ans[i][j] << " ";
        }
        cout << "\n";
      }
    } else {
      rep(j, 0, m) {
        rep(i, 0, n) {
          cout << ans[i][j] << " ";
        }
        cout << "\n";
      }
    }
  }
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);cout.tie(0);
  cout << fixed << setprecision(10);

  int t = 1;

  // cin >> t;

  for (int tc = 1; tc <= t; tc++) {
    solve();
  }
}


#include <bits/stdc++.h>

using namespace std;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using piii = pair<int, pii>;
using plll = pair<ll, pll>;
using pib = pair<int, bool>;
using pdi = pair<double, int>;
using pid = pair<int, double>;
using ld = long double;
using piiii = pair<pii, pii>;

#define endl "\n"
#define inf 0x3f3f3f3f3f
#define f first
#define s second

ll gcd(ll a, ll b){return b == 0 ? a : gcd(b, a % b);}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
ll fpow(ll  b, ll exp, ll mod){if(exp == 0) return 1;ll t = fpow(b,exp/2,mod);if(exp&1) return t*t%mod*b%mod;return t*t%mod;}
ll divmod(ll i, ll j, ll mod){i%=mod,j%=mod;return i*fpow(j,mod-2,mod)%mod;}

int n, m, arr[101][101], ans[101][101];
bool f;

int main() {
    //freopen("cowmbat.in", "r", stdin);
    //freopen("cowmbat.out", "w", stdout);
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin >> n >> m;
    if (n>m) {
        f = true;
        swap(n, m);
    }
    if (n==1){
        if (m==1){
            cout << 1 << endl;
        }else if (m<=4){
            cout << -1 << endl;
        }else{
            for (int i=1; i<=m; i+=2){
                cout << i << " ";
            }
            for (int i=2; i<=m; i+=2){
                cout << i << " ";
            }
            cout << endl;
        }
        return 0;
    }else if (n==2&&m==2){
        cout << -1 << endl;
        return 0;
    }
    int t = 0;
    for (int i=1; i<=n; i++){
        for (int j=1; j<=m; j++){
            arr[i][j] = ans[i][j] = ++t;
        }
    }
    for (int j=1; j<=m; j+=2){
        for (int i=1; i<=n; i++){
            ans[i][j] = arr[(i)%n+1][j];
        }
    }
    if (f){
        for (int j=1; j<=m; j++){
            for (int i=1; i<=n; i++){
                cout << ans[i][j] << " ";
            }
            cout << endl;
        }
    }else{
        for (int i=1; i<=n; i++){
            for (int j=1; j<=m; j++){
                cout << ans[i][j] << " ";
            }
            cout << endl;
        }
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using piii = pair<int, pii>;
using plll = pair<ll, pll>;
using pib = pair<int, bool>;
using pdi = pair<double, int>;
using pid = pair<int, double>;
using ld = long double;
using piiii = pair<pii, pii>;

#define endl "\n"
#define inf 0x3f3f3f3f3f
#define f first
#define s second

ll gcd(ll a, ll b){return b == 0 ? a : gcd(b, a % b);}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
ll fpow(ll  b, ll exp, ll mod){if(exp == 0) return 1;ll t = fpow(b,exp/2,mod);if(exp&1) return t*t%mod*b%mod;return t*t%mod;}
ll divmod(ll i, ll j, ll mod){i%=mod,j%=mod;return i*fpow(j,mod-2,mod)%mod;}

int n, m, arr[101][101], ans[101][101];
bool f;

int main() {
    //freopen("cowmbat.in", "r", stdin);
    //freopen("cowmbat.out", "w", stdout);
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin >> n >> m;
    if (n>m) {
        f = true;
        swap(n, m);
    }
    if (n==1){
        if (m==1){
            cout << 1 << endl;
        }else if (m<4){
            cout << -1 << endl;
        }else if (m==4){
            cout << "3 1 4 2" << endl;
        }else{
            for (int i=1; i<=m; i+=2){
                cout << i << " ";
            }
            for (int i=2; i<=m; i+=2){
                cout << i << " ";
            }
            cout << endl;
        }
        return 0;
    }else if (n==2&&m==2){
        cout << -1 << endl;
        return 0;
    }
    int t = 0;
    for (int i=1; i<=n; i++){
        for (int j=1; j<=m; j++){
            arr[i][j] = ans[i][j] = ++t;
        }
    }
    for (int j=1; j<=m; j+=2){
        for (int i=1; i<=n; i++){
            ans[i][j] = arr[(i)%n+1][j];
        }
    }
    if (f){
        for (int j=1; j<=m; j++){
            for (int i=1; i<=n; i++){
                cout << ans[i][j] << " ";
            }
            cout << endl;
        }
    }else{
        for (int i=1; i<=n; i++){
            for (int j=1; j<=m; j++){
                cout << ans[i][j] << " ";
            }
            cout << endl;
        }
    }
    return 0;
}


#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 1e2 + 10;
int dx[] = { 0,0,1,-1 };
int dy[] = { 1,-1,0,0 };
int a[N][N];
void check(int n, int m)
{
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= m; j++)
		{
			for (int o = 0; o < 4; o++)
			{
				int x = a[i][j];
				int y = a[i + dx[o]][j + dy[o]];
				if (abs(x - y) == 1) return;
			}
		}
	}
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= m; j++)
		{
			printf("%d%c", a[i][j], " \n"[j == m]);
		}
	}
	exit(0);
}
void solve(vector<int>& v, int n, int m)
{
	random_shuffle(v.begin(), v.end());
	int ptr = 0;
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= m; j++)
		{
			a[i][j] = v[ptr++];
		}
	}
	check(n, m);
}
int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n, m;
	cin >> n >> m;
	MEM(a, 0x3f);
	vector<int> v;
	for (int i = 1; i <= n * m; i++) v.push_back(i);
	int cnt = 100;
	while (cnt--)
	{
		solve(v, n, m);
	}
	puts("-1");
	return 0;
}


#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 1e2 + 10;
int dx[] = { 0,0,1,-1 };
int dy[] = { 1,-1,0,0 };
int a[N][N];
void check(int n, int m)
{
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= m; j++)
		{
			for (int o = 0; o < 4; o++)
			{
				int x = a[i][j];
				int y = a[i + dx[o]][j + dy[o]];
				if (abs(x - y) == 1) return;
			}
		}
	}
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= m; j++)
		{
			printf("%d%c", a[i][j], " \n"[j == m]);
		}
	}
	exit(0);
}
void solve(vector<int>& v, int n, int m)
{
	random_shuffle(v.begin(), v.end());
	int ptr = 0;
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= m; j++)
		{
			a[i][j] = v[ptr++];
		}
	}
	check(n, m);
}
int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n, m;
	cin >> n >> m;
	MEM(a, 0x3f);
	vector<int> v;
	for (int i = 1; i <= n * m; i++) v.push_back(i);
	int cnt = 1000;
	while (cnt--)
	{
		solve(v, n, m);
	}
	puts("-1");
	return 0;
}


#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <map>
#include <set>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <cassert>

using namespace std;

#define pb push_back
#define mp make_pair
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long LL;
typedef pair<int, int> PII;

int n, m;
int ans[100][100];

int main() {
    scanf("%d%d", &n, &m);
    if (n + m <= 4) {
        if (n == 1 && m == 1) {
            cout << 1 << endl;
            return 0;
        }
        printf("-1\n");
        return 0;
    }
    int cur = n * m;
    if (cur % 2 == 0) --cur;
        REP(i, n) REP(j, m) {
            ans[i][j] = cur;
            if (cur - 2 == -1) {
                cur = n * m;
                if (cur % 2 == 1) --cur;
            } else {
                cur -= 2;
            }
        }
    REP(i, n) {
        REP(j, m) printf("%d ", ans[i][j]);
        printf("\n");
    }
    return 0;
}


//@Shashank Keshav
//I want to listen to music lying on a riverbank and watch the auroras dance in the night sky

//<------------------------------------------Template------------------------------------------>

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define in insert
#define F first
#define S second
#define ub upper_bound
#define lb lower_bound
#define acc accumulate
#define bin binary_search
#define vmin *min_element
#define vmax *max_element
#define max_pq priority_queue<int, vint>
#define min_pq priority_queue<int, vint, greater<int>>
#define vstr vector<string>
#define vint vector<int>
#define vpint vector<pint>
#define vvint vector<vint>
#define mint map<int, int>
#define umint unordered_map<int, int>
#define usint unordered_set<int, int>
#define pint pair<int, int>
#define sz(a) (int) a.size()
#define aint(v) v.begin(), v.end()
#define mem(v, val) memset(v, val, sizeof(v))
#define rsort(v) sort(aint(v), greater<int>())
#define shflv(v) shuffle(aint(v), rng)
#define shfla(a, n) shuffle(a, a + n, rng)
#define setbits(x) __builtin_popcountint(x)
#define zrobits(x) __builtin_ctzint(x)
#define preci(x, y) fixed << setprecision(y) << x
#define iter(it, a) for (auto &it : a)
#define fo(i, a, b) for (int i = a; i < b; i++)
#define rfo(i, a, b) for (int i = a; i >= b; i--)
#define arrin(arr, start, n) for (int A = start; A < n; A++) cin >> arr[A];
#define ipmat(v,n,m) for (int C = 0; C < n; C++) for (int D = 0; D < m; D++) cin >> v[C][D];
#define print(arr, a, b) for (int B = a; B < b; B++) cout << arr[B] << " "; cout << endl;
#define printmat(v, r, c) for (int I = 0; I < r; I++) { for (int J = 0; J < c; J++) cout << v[I][J] << " "; cout << endl; }
const int mod = 1000000007;
const int pmod = 998244353;
const int maxN = 1000001;
#define PI 3.1415926535897932384626
#define inf intONG_MAX
#define minf intONG_MIN
#define FBO find_by_order
#define OOK order_of_key
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}
#else
#define trace(...)
#endif
#define msg cout<<"Nikal laude pehli fursat mein nikal";

//<------------------------------------------Code------------------------------------------>

void cR()
{
	int n, m;
	cin>>n>>m;
		if (n == m && n == 1)
	{
		cout << 1 << endl;
		return;
	}
// 	trace(n,m);
	if ((n * m) < 4)
	{
	   // msg;
		cout << -1 << endl;
		return;
	}
	if ((n * m) == 4)
	{
		if (n == 2 && m == 2)
		{
			cout << -1 << endl;
		}
		else if (n == 4)
		{
			cout << "3\n1\n4\n2" << endl;
		}
		else
		{
			cout << "3 1 4 2" << endl;
		}
		return;
	}
	int cur = n * m;
	int ans[n][m];
	if (cur % 2 == 0) --cur;
	if (n >= m) {
		fo(i, 0, n) fo(j, 0, m) {
			ans[i][j] = cur;
			if (cur - 2 == -1) {
				cur = n * m;
				if (cur % 2 == 1) --cur;
			} else {
				cur -= 2;
			}
		}
	} else {
		fo(j, 0, m) fo(i, 0, n) {
			ans[i][j] = cur;
			if (cur - 2 == -1) {
				cur = n * m;
				if (cur % 2 == 1) --cur;
			} else {
				cur -= 2;
			}
		}
	}
	fo(i, 0, n) {
		fo(j, 0, m) printf("%d ", ans[i][j]);
		printf("\n");
	}
}
main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("output999.txt", "w", stdout);
#endif
	int T = 1;
	//cin>>T;
	while (T--)
	{
		cR();
	}
}


//@Shashank Keshav
//I want to listen to music lying on a riverbank and watch the auroras dance in the night sky

//<------------------------------------------Template------------------------------------------>

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define in insert
#define F first
#define S second
#define ub upper_bound
#define lb lower_bound
#define acc accumulate
#define bin binary_search
#define vmin *min_element
#define vmax *max_element
#define max_pq priority_queue<int, vint>
#define min_pq priority_queue<int, vint, greater<int>>
#define vstr vector<string>
#define vint vector<int>
#define vpint vector<pint>
#define vvint vector<vint>
#define mint map<int, int>
#define umint unordered_map<int, int>
#define usint unordered_set<int, int>
#define pint pair<int, int>
#define sz(a) (int) a.size()
#define aint(v) v.begin(), v.end()
#define mem(v, val) memset(v, val, sizeof(v))
#define rsort(v) sort(aint(v), greater<int>())
#define shflv(v) shuffle(aint(v), rng)
#define shfla(a, n) shuffle(a, a + n, rng)
#define setbits(x) __builtin_popcountint(x)
#define zrobits(x) __builtin_ctzint(x)
#define preci(x, y) fixed << setprecision(y) << x
#define iter(it, a) for (auto &it : a)
#define fo(i, a, b) for (int i = a; i < b; i++)
#define rfo(i, a, b) for (int i = a; i >= b; i--)
#define arrin(arr, start, n) for (int A = start; A < n; A++) cin >> arr[A];
#define ipmat(v,n,m) for (int C = 0; C < n; C++) for (int D = 0; D < m; D++) cin >> v[C][D];
#define print(arr, a, b) for (int B = a; B < b; B++) cout << arr[B] << " "; cout << endl;
#define printmat(v, r, c) for (int I = 0; I < r; I++) { for (int J = 0; J < c; J++) cout << v[I][J] << " "; cout << endl; }
const int mod = 1000000007;
const int pmod = 998244353;
const int maxN = 1000001;
#define PI 3.1415926535897932384626
#define inf intONG_MAX
#define minf intONG_MIN
#define FBO find_by_order
#define OOK order_of_key
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}
#else
#define trace(...)
#endif
#define msg cout<<"Nikal laude pehli fursat mein nikal";

//<------------------------------------------Code------------------------------------------>

void cR()
{
	int n, m;
	if (n == m && n == 1)
	{
		cout << 1 << endl;
	}
	if (n * m < 4)
	{
		cout << -1 << endl;
		return;
	}
	if (n * m == 4)
	{
		if (n == 2 && m == 2)
		{
			cout << -1 << endl;
		}
		else if (n == 4)
		{
			cout << "3\n1\n4\n2" << endl;
		}
		else
		{
			cout << "3 1 4 2" << endl;
		}
		return;
	}
	int cur = n * m;
	int ans[n][m];
	if (cur % 2 == 0) --cur;
	if (n >= m) {
		fo(i, 0, n) fo(j, 0, m) {
			ans[i][j] = cur;
			if (cur - 2 == -1) {
				cur = n * m;
				if (cur % 2 == 1) --cur;
			} else {
				cur -= 2;
			}
		}
	} else {
		fo(j, 0, m) fo(i, 0, n) {
			ans[i][j] = cur;
			if (cur - 2 == -1) {
				cur = n * m;
				if (cur % 2 == 1) --cur;
			} else {
				cur -= 2;
			}
		}
	}
	fo(i, 0, n) {
		fo(j, 0, m) printf("%d ", ans[i][j]);
		printf("\n");
	}
}
main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input999.txt", "r", stdin);
	freopen("output999.txt", "w", stdout);
#endif
	int T = 1;
	//cin>>T;
	while (T--)
	{
		cR();
	}
}


#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <map>
#include <set>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <cassert>

using namespace std;

#define pb push_back
#define mp make_pair
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long LL;
typedef pair<int, int> PII;

int n, m;
int ans[100][100];

int main() {
    scanf("%d%d", &n, &m);
    if (n + m <= 4) {
        if (n == 1 && m == 1) {
            cout << 1 << endl;
            return 0;
        }
        printf("-1\n");
        return 0;
    }
    int cur = n * m;
    if (cur % 2 == 0) --cur;
    if (n >= m) {
        REP(i, n) REP(j, m) {
            ans[i][j] = cur;
            if (cur - 2 == -1) {
                cur = n * m;
                if (cur % 2 == 1) --cur;
            } else {
                cur -= 2;
            }
        }
    }
    REP(i, n) {
        REP(j, m) printf("%d ", ans[i][j]);
        printf("\n");
    }
    return 0;
}


#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <map>
#include <set>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <cassert>

using namespace std;

#define pb push_back
#define mp make_pair
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long LL;
typedef pair<int, int> PII;

int n, m;
int ans[100][100];

int main() {
    scanf("%d%d", &n, &m);
    if (n + m <= 4) {
        if (n == 1 && m == 1) {
            cout << 1 << endl;
            return 0;
        }
        printf("-1\n");
        return 0;
    }
    int cur = n * m;
    if (cur % 2 == 0) --cur;
        REP(i, n) REP(j, m) {
            ans[i][j] = cur;
            if (cur - 2 == -1) {
                cur = n * m;
                if (cur % 2 == 1) --cur;
            } else {
                cur -= 2;
            }
        }
    } else {
        REP(j, m) REP(i, n) {
            ans[i][j] = cur;
            if (cur - 2 == -1) {
                cur = n * m;
                if (cur % 2 == 1) --cur;
            } else {
                cur -= 2;
            }
        }
    }
    REP(i, n) {
        REP(j, m) printf("%d ", ans[i][j]);
        printf("\n");
    return 0;
}


//@Shashank Keshav
//I want to listen to music lying on a riverbank and watch the auroras dance in the night sky

//<------------------------------------------Template------------------------------------------>

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define in insert
#define F first
#define S second
#define ub upper_bound
#define lb lower_bound
#define acc accumulate
#define bin binary_search
#define vmin *min_element
#define vmax *max_element
#define max_pq priority_queue<int, vint>
#define min_pq priority_queue<int, vint, greater<int>>
#define vstr vector<string>
#define vint vector<int>
#define vpint vector<pint>
#define vvint vector<vint>
#define mint map<int, int>
#define umint unordered_map<int, int>
#define usint unordered_set<int, int>
#define pint pair<int, int>
#define sz(a) (int) a.size()
#define aint(v) v.begin(), v.end()
#define mem(v, val) memset(v, val, sizeof(v))
#define rsort(v) sort(aint(v), greater<int>())
#define shflv(v) shuffle(aint(v), rng)
#define shfla(a, n) shuffle(a, a + n, rng)
#define setbits(x) __builtin_popcountint(x)
#define zrobits(x) __builtin_ctzint(x)
#define preci(x, y) fixed << setprecision(y) << x
#define iter(it, a) for (auto &it : a)
#define fo(i, a, b) for (int i = a; i < b; i++)
#define rfo(i, a, b) for (int i = a; i >= b; i--)
#define arrin(arr, start, n) for (int A = start; A < n; A++) cin >> arr[A];
#define ipmat(v,n,m) for (int C = 0; C < n; C++) for (int D = 0; D < m; D++) cin >> v[C][D];
#define print(arr, a, b) for (int B = a; B < b; B++) cout << arr[B] << " "; cout << endl;
#define printmat(v, r, c) for (int I = 0; I < r; I++) { for (int J = 0; J < c; J++) cout << v[I][J] << " "; cout << endl; }
const int mod = 1000000007;
const int pmod = 998244353;
const int maxN = 1000001;
#define PI 3.1415926535897932384626
#define inf intONG_MAX
#define minf intONG_MIN
#define FBO find_by_order
#define OOK order_of_key
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}
#else
#define trace(...)
#endif
#define msg cout<<"Nikal laude pehli fursat mein nikal";

//<------------------------------------------Code------------------------------------------>

void cR()
{
	int n, m;
	cin>>n>>m;
// 	trace(n,m);
	if ((n * m) < 4)
	{
	   // msg;
		cout << -1 << endl;
		return;
	}
	if ((n * m) == 4)
	{
		if (n == 2 && m == 2)
		{
			cout << -1 << endl;
		}
		else if (n == 4)
		{
			cout << "3\n1\n4\n2" << endl;
		}
		else
		{
			cout << "3 1 4 2" << endl;
		}
		return;
	}
	int cur = n * m;
	int ans[n][m];
	if (cur % 2 == 0) --cur;
	if (n >= m) {
		fo(i, 0, n) fo(j, 0, m) {
			ans[i][j] = cur;
			if (cur - 2 == -1) {
				cur = n * m;
				if (cur % 2 == 1) --cur;
			} else {
				cur -= 2;
			}
		}
	} else {
		fo(j, 0, m) fo(i, 0, n) {
			ans[i][j] = cur;
			if (cur - 2 == -1) {
				cur = n * m;
				if (cur % 2 == 1) --cur;
			} else {
				cur -= 2;
			}
		}
	}
	fo(i, 0, n) {
		fo(j, 0, m) printf("%d ", ans[i][j]);
		printf("\n");
	}
}
main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("output999.txt", "w", stdout);
#endif
	int T = 1;
	//cin>>T;
	while (T--)
	{
		cR();
	}
}


//@Shashank Keshav
//I want to listen to music lying on a riverbank and watch the auroras dance in the night sky

//<------------------------------------------Template------------------------------------------>

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define in insert
#define F first
#define S second
#define ub upper_bound
#define lb lower_bound
#define acc accumulate
#define bin binary_search
#define vmin *min_element
#define vmax *max_element
#define max_pq priority_queue<int, vint>
#define min_pq priority_queue<int, vint, greater<int>>
#define vstr vector<string>
#define vint vector<int>
#define vpint vector<pint>
#define vvint vector<vint>
#define mint map<int, int>
#define umint unordered_map<int, int>
#define usint unordered_set<int, int>
#define pint pair<int, int>
#define sz(a) (int) a.size()
#define aint(v) v.begin(), v.end()
#define mem(v, val) memset(v, val, sizeof(v))
#define rsort(v) sort(aint(v), greater<int>())
#define shflv(v) shuffle(aint(v), rng)
#define shfla(a, n) shuffle(a, a + n, rng)
#define setbits(x) __builtin_popcountint(x)
#define zrobits(x) __builtin_ctzint(x)
#define preci(x, y) fixed << setprecision(y) << x
#define iter(it, a) for (auto &it : a)
#define fo(i, a, b) for (int i = a; i < b; i++)
#define rfo(i, a, b) for (int i = a; i >= b; i--)
#define arrin(arr, start, n) for (int A = start; A < n; A++) cin >> arr[A];
#define ipmat(v,n,m) for (int C = 0; C < n; C++) for (int D = 0; D < m; D++) cin >> v[C][D];
#define print(arr, a, b) for (int B = a; B < b; B++) cout << arr[B] << " "; cout << endl;
#define printmat(v, r, c) for (int I = 0; I < r; I++) { for (int J = 0; J < c; J++) cout << v[I][J] << " "; cout << endl; }
const int mod = 1000000007;
const int pmod = 998244353;
const int maxN = 1000001;
#define PI 3.1415926535897932384626
#define inf intONG_MAX
#define minf intONG_MIN
#define FBO find_by_order
#define OOK order_of_key
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}
#else
#define trace(...)
#endif
#define msg cout<<"Nikal laude pehli fursat mein nikal";

//<------------------------------------------Code------------------------------------------>

void cR()
{
	int n, m;
	cin>>n>>m;
		if (n == m && n == 1)
	{
		cout << 1 << endl;
	}
// 	trace(n,m);
	if ((n * m) < 4)
	{
	   // msg;
		cout << -1 << endl;
		return;
	}
	if ((n * m) == 4)
	{
		if (n == 2 && m == 2)
		{
			cout << -1 << endl;
		}
		else if (n == 4)
		{
			cout << "3\n1\n4\n2" << endl;
		}
		else
		{
			cout << "3 1 4 2" << endl;
		}
		return;
	}
	int cur = n * m;
	int ans[n][m];
	if (cur % 2 == 0) --cur;
	if (n >= m) {
		fo(i, 0, n) fo(j, 0, m) {
			ans[i][j] = cur;
			if (cur - 2 == -1) {
				cur = n * m;
				if (cur % 2 == 1) --cur;
			} else {
				cur -= 2;
			}
		}
	} else {
		fo(j, 0, m) fo(i, 0, n) {
			ans[i][j] = cur;
			if (cur - 2 == -1) {
				cur = n * m;
				if (cur % 2 == 1) --cur;
			} else {
				cur -= 2;
			}
		}
	}
	fo(i, 0, n) {
		fo(j, 0, m) printf("%d ", ans[i][j]);
		printf("\n");
	}
}
main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("output999.txt", "w", stdout);
#endif
	int T = 1;
	//cin>>T;
	while (T--)
	{
		cR();
	}
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mod 998244353
#define MEM(x,val) memset(x,val,sizeof(x))
#define ll long long
#define F first
#define S second
#define pii pair<int,int>
#define ALL(x) x.begin(),x.end()
#define FAST ios_base::sync_with_stdio(false);cin.tie(0);
int II(){int q;scanf("%d",&q);return q;}
ll LII(){ll q;scanf("%lld",&q);return q;}

void solve(){
	int N,M; cin>>N>>M;
	if((N*M) == 1){
		cout<<1<<endl;
		return;
	}
	if((N*M)<=3 or (N == 2 and M == 2)){
		cout<<-1<<endl;
		return;
	}
	if(N == 1){
		for(int i = 2; i<=M; i+=2) cout<<i<<" ";
		for(int i = 1; i<=M; i+=2) cout<<i<<" ";
		cout<<endl;
		return;
	}
	if(M == 1){
		for(int i = 2; i<=N; i+=2) cout<<i<<endl;
		for(int i = 1; i<=N; i+=2) cout<<i<<endl;
		return;
	}
	int ar[N+10][M+10];
	int cc = 1;
	for(int i = 1; i<=N; i++){
		for(int j = 1; j<=M; j++){
			ar[i][j] = cc++;
		}
	}
	for(int j = 2; j<=M; j+=2){
		int q = ar[1][j];
		for(int i = 1; i<=N; i++){
			if(i<N) ar[i][j] = ar[i+1][j];
			else ar[i][j] = q;
		}
	}
	for(int i = 1; i<=N; i++){
		for(int j = 1; j<=M; j++){
			cout<<ar[i][j]<<" ";
		}
		cout<<endl;
	}
}

int32_t main(){
  #ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  #endif
  int tt; tt = 1;
  while(tt--){
    //printf("Case %d: ",cas++);
    solve();
  }
}


//“Failure is unimportant. It takes courage to make a fool of yourself.”

#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"
typedef long long int ll;
#define int long long int
#define P 1000000007
#define sz(a) (ll)a.size()
#define lt(a) (ll)a.length()
#define pll pair<ll,ll>
#define f(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define b(i,a,b) for(ll i=(ll)a;i>=(ll)b;i--)
#define mll map<ll,ll>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define teevra_gati ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define N 100005
#define PI 3.14159265359
#define inf LLONG_MAX
using namespace __gnu_pbds;
using namespace std;
signed main() {
    teevra_gati
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif

    ll n,m;
    cin>>n>>m;
    if(n+m<5) return cout<<1,0;
    ll p=1, q = (n*m)/2 + 1;
    f(i,0,n){
        f(j,0,m){
            ll s=(i+j)%2;
            if(s) cout<<p<<" ", p++;
            else cout<<q<<" ", q++;
        }
        cout<<endl;
    }
    return 0;
}


//“Failure is unimportant. It takes courage to make a fool of yourself.”

#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"
typedef long long int ll;
#define int long long int
#define P 1000000007
#define sz(a) (ll)a.size()
#define lt(a) (ll)a.length()
#define pll pair<ll,ll>
#define f(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define b(i,a,b) for(ll i=(ll)a;i>=(ll)b;i--)
#define mll map<ll,ll>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define teevra_gati ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define N 100005
#define PI 3.14159265359
#define inf LLONG_MAX
using namespace __gnu_pbds;
using namespace std;
signed main() {
    teevra_gati
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif

    ll n,m;
    cin>>n>>m;
    if(n*m==1) return cout<<1,0;
    if(n+m<5) return cout<<-1,0;
    ll p=1, q = (n*m)/2 + 1;
    f(i,0,n){
        f(j,0,m){
            ll s=(i+j)%2;
            if(s) cout<<p<<" ", p++;
            else cout<<q<<" ", q++;
        }
        cout<<endl;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define x first
#define y second
#define ll long long
const int oo = 1e9 + 9;
const ll inf = 1e18 + 18;
const int max6 = 1e6 + 6;
const int modx = 1e9 + 7;
const int mody = 997;
const int base = 137;
typedef pair <int,int> ii;
//////////////////////////

int a[1005][1005];

//////////////////////////
main()
{
    ios_base::sync_with_stdio(false);
#ifndef ONLINE_JUDGE
#define file ""
    freopen(file"inp","r",stdin);
    freopen(file"out","w",stdout);
#endif // ONLINE_JUDGE

    int n,m;
    cin >> m >> n;

    int cur = 1;
    for (int i = 1; i <= m; ++i)
        for (int j = 1; j <= n; ++j)
            if ((i+j)%2)
                a[i][j] = cur++;

    for (int i = 1; i <= m; ++i)
        for (int j = 1; j <= n; ++j  )
            if (a[i][j] == 0)
                a[i][j] = cur++;

    bool ok = true;
    for (int i = 1; i <= m; ++i)
        for (int j = 1; j <= n; ++j)
        {
            if (j-1 && abs(a[i][j]-a[i][j-1]) <= 1)
                ok = false;
            if (j+1 <= n && abs(a[i][j]-a[i][j+1]) <= 1)
                ok = false;
            if (i-1 && abs(a[i][j]-a[i-1][j]) <= 1)
                ok = false;
            if (i+1 <= m && abs(a[i][j]-a[i+1][j]) <= 1)
                ok = false;
        }

    if (!ok)
    {
        cout<<-1;
        return 0;
    }

    for (int i = 1; i <= m; ++i)
    {
        for (int j = 1; j <= n; ++j)
            cout<<a[i][j]<<" ";
        cout<<"\n";
    }

}


/*
त्यक्तवाधर्मं च लोभं च
मोहंचो द्यमास्थिता।
युद्ध्यध्वमनहंकारा
यतो धर्मस्ततो जयः।।
*/
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
using namespace std;
#define int     long long int
#define ld      long double
#define pb      push_back
#define pa      pair<int,int>
#define v1d     vector<int>
#define v2d     vector<vector<int> >
#define M       998244353
#define MN      LLONG_MIN
#define MX      LLONG_MAX
#define ff      first
#define ss      second
#define endl    "\n"
#define v1s     vector<string>
#define S(v)    sort(v.begin(),v.end())
#define RS(v)   sort(v.rbegin(),v.rend())
#define R(v)    reverse(v.begin(),v.end())
#define mxpq(T)    priority_queue <T>
#define mnpq(T)    priority_queue<T,vector<T>,greater<T>>
#define T       int tc;cin>>tc;while(tc--)
#define p2d(v)     for(auto a:v){for(auto b:a)cout<<b<<" ";cout<<endl;}
#define p1d(v)		for(auto a:v)cout<<a<<" ";cout<<endl

void Weapons19(){
	cout<<fixed<<setprecision(16);
    cin.sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    #ifndef ONLINE_JUDGE
     freopen("input.txt",  "r",  stdin);
     freopen("output.txt", "w", stdout);
    #endif
}
#define qqq 100005

int32_t main(){
    Weapons19();
    int n,m;cin>>n>>m;
    v2d v(n,v1d(m));
    int k=n*m;
    if(k%2==0)k--;
    for(int i=0;i<n;i++){
    	for(int j=0;j<m;j++){
    		if(k<1)break;
    		v[i][j]=k;k-=2;
    	}
    }
    map<int,int>z;
    k=2;//p2d(v);
    v1d skip;
    for(int i=0;i<n;i++){
    	for(int j=0;j<m;j++){
    		if(v[i][j]==0){
    			for(int p=0;p<skip.size();p++){
    				if((i==0||abs(skip[p]-v[i-1][j])!=1)&&
    					(j==0||abs(skip[p]-v[i][j-1])!=1)){
    					v[i][j]=skip[p];skip.erase(skip.begin()+p);break;
    				}
    			}
    			if(v[i][j]!=0)continue;
    			while((i>0&&abs(k-v[i-1][j])==1)||(j>0&&abs(k-v[i][j-1])==1)){
    			skip.pb(k);k+=2;}
    			if(k>n*m){cout<<-1;return 0;}
    			v[i][j]=k;k+=2;//cout<<k;
    		}
    	}
    }
	p2d(v);

}


#include <bits/stdc++.h>

#define pb push_back
#define ll long long
#define F first
#define S second

using namespace std;

const ll inf = 1e18;
const int mod = 1e9 + 7;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n,m;
    cin >> n >> m;
    if (n * m == 1){
        cout << 1 << endl;
        return 0;
    }
    if (m + n < 5){
        cout << -1 << endl;
        return 0;
    }
    int a = 1, b = (n * m) / 2 + 1;
    for (int i=0;i<n;i++){
        for (int j=0;j<m;j++){
            if ((i+j)%2){
                cout << a << " ";
                a++;
            } else {
                cout << b << " ";
                b++;
            }
        }
        cout << endl;
    }
}


#include<bits/stdc++.h>
using namespace std;
const int MAX=109;
int n,m,t1,t2=1;
int main()
{
 cin>>n>>m;
 if (n==m && n==1) return cout<<1,0;
 if (m+n<5) return cout<<-1,0;
 t1=n*m/2+1;
 for (int i=0;i<n;i++,cout<<'\n')
  for (int j=0;j<m;j++)
   if ((i+j)%2==0)
    cout<<t1<<" ",t1++;
   else
    cout<<t2<<" ",t2++;
}


#include <bits/stdc++.h>
using namespace std;
int a[200];
int main()
{
  //  freopen("input.txt", "r", stdin);
  //  freopen("output.txt", "w", stdout);
    int n, m;
    cin >> n >> m;
    if (n == 1 && m == 1)
    {
        cout << 1 << endl;
        return 0;
    }
    if (m + n < 5)
    {
        cout << -1 << endl;
        return 0;
    }
    int a = 1;
    int  b = (n * m) / 2 + 1;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < m; j++)
        {
            if ((i+j) % 2 == 1)
            {
                cout << a << " ";
                a++;
            }
            else
            {
                cout << b << " ";
                b++;
            }
        }
        cout << endl;
    }
}


#include <bits/stdc++.h>

using namespace std;

int n, m;

int a[106][106];

int main() {
	cin >> n >> m;
	if (set<pair<int,int>>{{1, 2}, {1, 3}, {2, 2}}.count(minmax(n, m))) {
		puts("-1");
		return 0;
	}

	int t = 0;
	for (int i = 1; i <= n; ++i)
		for (int j = 1; j <= m; ++j)
			if ((i ^ j) & 1)
				a[i][j] = ++t;
	for (int i = 1; i <= n; ++i)
		for (int j = 1; j <= m; ++j)
			if (~(i ^ j) & 1)
				a[i][j] = ++t;

	for (int i = 1; i <= n; ++i) {
		for (int j = 1; j <= m; ++j)
			printf("%d ", a[i][j]);
		puts("");
	}

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
#define sz(x) (int)(x).size()

const int N = 110;
int n, m, res[N][N];

bool can() {
  if (n == 1 && m ==1) return res[0][0] = 1, true;
  if ((n == 1 && m < 4) ||
      (m == 1 && n < 4) ||
      (n == 2 && m == 2)) {
    return false;
  }

  vector<ii> dark, light;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if ((i + j) & 1) dark.push_back({i, j});
      else light.push_back({i, j});
    }
  }

  int k = 1;
  for (int i = 0; i < sz(dark); i++) {
    ii p = dark[i];
    res[p.first][p.second] = k++;
  }

  for (int i = 0; i < sz(light); i++) {
    ii p = light[i];
    res[p.first][p.second] = k++;
  }
  return true;
}

int main() {
  ios_base::sync_with_stdio(0); cin.tie(0);

  cin >> n >> m;
  if (can()) {
    for (int i = 0; i < n; i++)
      for (int j = 0; j < m; j++)
        cout << res[i][j] << (j == m - 1 ? '\n' : ' ');
  } else cout << -1 << '\n';
}


#include<bits/stdc++.h>
using namespace std;
#define fast {ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);}
typedef long long int ll;
typedef string S;
#define M 1e18
#define AS 250002
#define in(x)  cin>>x
#define o(x)  cout<<x
#define sp cout<<' '
#define nw cout<<endl
#define rt return
#define fr(i,a,n) for(ll i=a;i<=n;i++)
#define frm(i,a,n) for(ll i=n;i>=a;i--)
#define P pair<ll,ll>
#define vc vector<ll>
#define pb push_back
#define MP map<ll,ll>
bool sortin(const pair<ll,ll> &e,const pair<ll,ll> &f){return (e.first<f.first);}
ll i,j,k,l,m,n,c,p,q,ts,mn=10e17,mod=10e8+7;
ll a[AS],b[AS],x[AS];
int main()
{
    fast;
    in(n);in(m);
    q=n*m;
    if(q<4 or(n==2 and m==2)){o(-1);rt 0;}
    p=(q+1)/2;
   fr(i,1,n)
   {
       fr(j,1,m)
       {
           if((i+j)%2)o(q),q--;
           else o(p),p--;
           sp;
       }
       nw;
   }
}


#include<bits/stdc++.h>
using namespace std;
#define fast {ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);}
typedef long long int ll;
typedef string S;
#define M 1e18
#define AS 250002
#define in(x)  cin>>x
#define o(x)  cout<<x
#define sp cout<<' '
#define nw cout<<endl
#define rt return
#define fr(i,a,n) for(ll i=a;i<=n;i++)
#define frm(i,a,n) for(ll i=n;i>=a;i--)
#define P pair<ll,ll>
#define vc vector<ll>
#define pb push_back
#define MP map<ll,ll>
bool sortin(const pair<ll,ll> &e,const pair<ll,ll> &f){return (e.first<f.first);}
ll i,j,k,l,m,n,c,p,q,ts,mn=10e17,mod=10e8+7;
ll a[AS],b[AS],x[AS];
int main()
{
    fast;
    in(n);in(m);
    q=n*m;
    if(q==1){o(1);rt 0;}
    if(q<4 or(n==2 and m==2)){o(-1);rt 0;}
    p=(q+1)/2;
   fr(i,1,n)
   {
       fr(j,1,m)
       {
           if((i+j)%2)o(q),q--;
           else o(p),p--;
           sp;
       }
       nw;
   }
}


#include <bits/stdc++.h>

using namespace std;

int main(){
  int n, m;
  cin >> n >> m;
  int total = n*m;

  if (total == 2 || total == 3 || (m == 2 && n == 2)){
    cout << "-1" << endl;
  } else {
    int low = (total + 1)/2;
    int hi = total;
    for(int i=0; i<n; i++){
      for(int j=0; j<m; j++){
        if ( (i+j) % 2){
          cout << hi << " ";
          hi--;
        } else {
          cout << low << " ";
          low--;
        }
      }
      cout << endl;
    }
  }
  return 0;

}


#include<bits/stdc++.h>

using namespace std;

int ans[105][105];
int r,c;

bool isValid(){
	for(int i=1; i<c; i++){
		if(abs(ans[1][i]-ans[1][i+1])==1) return false;
	}
	for(int i=1; i<r; i++){
		if(abs(ans[i][1]-ans[i+1][1])==1) return false;
	}
	for(int i=1; i<r; i++){
		for(int j=1; j<c; j++) if(abs(ans[i][j]-ans[i][j+1])==1 || abs(ans[i][j]-ans[i+1][j])==1){
			return false;
		}
	}
	return true;
}

void print(){
	puts("DEBUG");
	for(int i=1; i<=r; i++){
		for(int j=1; j<=c; j++) printf("%d ",ans[i][j]);
		puts("");
	}
}
int main(){
	cin>>r>>c;
	for(int i=1; i<=r; i++){
		for(int j=1; j<=c; j++){
			ans[i][j]=-1;
		}
	}
	int left=1;
	if(c>=r){
		if(c>3){
			for(int i=1; i<=r; i++){
				for(int j=2; j<=c; j+=2){
					ans[i][j]=left;
					left++;
				}
				for(int j=1; j<=c; j+=2){
					ans[i][j]=left;
					left++;
				}
			}
		}
		else{
			int right=r*c;
			for(int i=1; i<=r; i++){
				if(i%2==1){
					for(int j=2; j<=c; j+=2){
						ans[i][j]=left;
						left++;
					}
					for(int j=1; j<=c; j+=2){
						ans[i][j]=right;
						right--;
					}
				}
				else{
					for(int j=1; j<=c; j+=2){
						ans[i][j]=left;
						left++;
					}
					for(int j=2; j<=c; j+=2){
						ans[i][j]=right;
						right--;
					}
				}
			}
		}
	}
	else{
		if(r>3){
			for(int i=1; i<=c; i++){
				for(int j=2; j<=r; j+=2){
					ans[j][i]=left;
					left++;
				}
				for(int j=1; j<=r; j+=2){
					ans[j][i]=left;
					left++;
				}
			}
		}
		else{
			int right=r*c;
			for(int i=1; i<=c; i++){
				if(i%2==1){
					for(int j=2; j<=r; j+=2){
						ans[j][i]=left;
						left++;
					}
					for(int j=1; j<=r; j+=2){
						ans[j][i]=right;
						right--;
					}
				}
				else{
					for(int j=1; j<=r; j+=2){
						ans[j][i]=left;
						left++;
					}
					for(int j=2; j<=r; j+=2){
						ans[j][i]=right;
						right--;
					}
				}
			}
		}
	}
//	print();
	if(isValid()){
		for(int i=1; i<=r; i++){
			for(int j=1; j<=c; j++){
				if(j>1) printf(" ");
				printf("%d",ans[i][j]);
			}
			puts("");
		}
	}
	else printf("-1\n");
	return 0;
}


#include<bits/stdc++.h>

using namespace std;

int ans[105][105];
int r,c;

bool isValid(){
	for(int i=1; i<c; i++){
		if(abs(ans[r][i]-ans[r][i+1])==1) return false;
	}
	for(int i=1; i<r; i++){
		if(abs(ans[i][c]-ans[i+1][c])==1) return false;
	}
	for(int i=1; i<r; i++){
		for(int j=1; j<c; j++) if(abs(ans[i][j]-ans[i][j+1])==1 || abs(ans[i][j]-ans[i+1][j])==1){
			return false;
		}
	}
	return true;
}

void print(){
	puts("DEBUG");
	for(int i=1; i<=r; i++){
		for(int j=1; j<=c; j++) printf("%d ",ans[i][j]);
		puts("");
	}
}
int main(){
	cin>>r>>c;
	for(int i=1; i<=r; i++){
		for(int j=1; j<=c; j++){
			ans[i][j]=-1;
		}
	}
	int left=1;
	if(r==1 && c==1) printf("1\n");
	else{
		if(c>=r){
			if(c>3){
				for(int i=1; i<=r; i++){
					for(int j=2; j<=c; j+=2){
						ans[i][j]=left;
						left++;
					}
					for(int j=1; j<=c; j+=2){
						ans[i][j]=left;
						left++;
					}
				}
			}
			else{
				int right=r*c/2+1;
				for(int i=1; i<=r; i++){
					if(i%2==1){
						for(int j=2; j<=c; j+=2){
							ans[i][j]=left;
							left++;
						}
						for(int j=1; j<=c; j+=2){
							ans[i][j]=right;
							right++;
						}
					}
					else{
						for(int j=1; j<=c; j+=2){
							ans[i][j]=left;
							left++;
						}
						for(int j=2; j<=c; j+=2){
							ans[i][j]=right;
							right++;
						}
					}
				}
			}
		}
		else{
			if(r>3){
				for(int i=1; i<=c; i++){
					for(int j=2; j<=r; j+=2){
						ans[j][i]=left;
						left++;
					}
					for(int j=1; j<=r; j+=2){
						ans[j][i]=left;
						left++;
					}
				}
			}
			else{
				int right=r*c/2+1;
				for(int i=1; i<=c; i++){
					if(i%2==1){
						for(int j=2; j<=r; j+=2){
							ans[j][i]=left;
							left++;
						}
						for(int j=1; j<=r; j+=2){
							ans[j][i]=right;
							right++;
						}
					}
					else{
						for(int j=1; j<=r; j+=2){
							ans[j][i]=left;
							left++;
						}
						for(int j=2; j<=r; j+=2){
							ans[j][i]=right;
							right++;
						}
					}
				}
			}
		}
	//	print();
		if(isValid()){
			for(int i=1; i<=r; i++){
				for(int j=1; j<=c; j++){
					if(j>1) printf(" ");
					printf("%d",ans[i][j]);
				}
				puts("");
			}
		}
		else printf("-1\n");
	}
	return 0;
}


#include<bits/stdc++.h>
#define ll long long
#define mp make_pair
using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr); cout.tie(nullptr);
	int n, m;
	bool f = true;
	cin >> n >> m;
	if (n > m) f = false, swap(n, m);
	vector<vector<int> > a(n + m + 1, vector<int>(n + m + 1, 0));
	if (n == 1) {
		if (m < 5) cout << "-1";
		else {
			for (int i = 1; i <= n; i += 2) cout << i << ' ';
			for (int i = 2; i <= n; i += 2) cout << i << ' ';
		}
	}
	else if (m == 1) {
		if (n < 5) cout << "-1";
		else {
			for (int i = 1; i <= n; i += 2) cout << i << '\n';
			for (int i = 2; i <= n; i += 2) cout << i << '\n';
		}
	}
	else if (n == 2 && m == 2) cout << "-1";
	else {
		int now = 1;
		pair<int, int> p = mp(0, 0);
		while (p.first + p.second < n + m) {
			auto tp = p;
			while (tp.first >= 0 && tp.second < m) {
				if (tp.second < m && tp.first < n) a[tp.first][tp.second] = now++;
				tp.first--, tp.second++;
			}
			p.first += 2;
		}
		p = mp(1, 0);
		while (p.first + p.second < n + m) {
			auto tp = p;
			while (tp.first >= 0 && tp.second < m) {
				if (tp.second < m && tp.first < n) a[tp.first][tp.second] = now++;
				tp.first--, tp.second++;
			}
			p.first += 2;
		}
		if (f) {
			for (int i = 0; i < n; ++i) {
				for (int j = 0; j < m; ++j) {
					cout << a[i][j] << ' ';
				}
				cout << '\n';
			}
		}
		else {
			for (int i = 0; i < m; ++i) {
				for (int j = 0; j < n; ++j) {
					cout << a[j][i] << ' ';
				}
				cout << '\n';
			}
		}
	}
	return 0;
}


#include<bits/stdc++.h>
#define ll long long
#define mp make_pair
using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr); cout.tie(nullptr);
	int n, m;
	cin >> n >> m;
	vector<vector<int> > a(n, vector<int>(m, 0));
	if (n == 1) {
		if (m < 5) cout << "-1";
		else {
			for (int i = 1; i <= n; i += 2) cout << i << ' ';
			for (int i = 2; i <= n; i += 2) cout << i << ' ';
		}
	}
	else if (m == 1) {
		if (n < 5) cout << "-1";
		else {
			for (int i = 1; i <= n; i += 2) cout << i << '\n';
			for (int i = 2; i <= n; i += 2) cout << i << '\n';
		}
	}
	else if (n == 2 || m == 2) cout << "-1";
	else {
		a[0][0] = 1;
		for (int i = 1; i < m; ++i)
			a[0][i] = a[0][i - 1] + n - 1;
		for (int i = 1; i < n; ++i) {
			for (int j = 0; j < m; ++j) {
				a[i][j] = a[i - 1][j] + n;
			}
		}
		for (int i = 0; i < n; ++i) {
			for (int j = 0; j < m; ++j)
				cout << a[i][j] << ' ';
			cout << '\n';
		}
	}
	return 0;
}


#include<bits/stdc++.h>
#define ll long long
#define mp make_pair
using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr); cout.tie(nullptr);
	int n, m;
	bool f = true;
	cin >> n >> m;
	if (n > m) f = false, swap(n, m);
	vector<vector<int> > a(n + m + 1, vector<int>(n + m + 1, 0));
	if (n == 1) {
		if (m < 5) cout << "-1";
		else {
			for (int i = 1; i <= n; i += 2) cout << i << ' ';
			for (int i = 2; i <= n; i += 2) cout << i << ' ';
		}
	}
	else if (n == 1 && m == 1) cout << 1;
	else if (m == 1) {
		if (n < 5) cout << "-1";
		else {
			for (int i = 1; i <= n; i += 2) cout << i << '\n';
			for (int i = 2; i <= n; i += 2) cout << i << '\n';
		}
	}
	else if (n == 2 && m == 2) cout << "-1";
	else {
		int now = 1;
		pair<int, int> p = mp(0, 0);
		while (p.first + p.second < n + m) {
			auto tp = p;
			while (tp.first >= 0 && tp.second < m) {
				if (tp.second < m && tp.first < n) a[tp.first][tp.second] = now++;
				tp.first--, tp.second++;
			}
			p.first += 2;
		}
		p = mp(1, 0);
		while (p.first + p.second < n + m) {
			auto tp = p;
			while (tp.first >= 0 && tp.second < m) {
				if (tp.second < m && tp.first < n) a[tp.first][tp.second] = now++;
				tp.first--, tp.second++;
			}
			p.first += 2;
		}
		if (f) {
			for (int i = 0; i < n; ++i) {
				for (int j = 0; j < m; ++j) {
					cout << a[i][j] << ' ';
				}
				cout << '\n';
			}
		}
		else {
			for (int i = 0; i < m; ++i) {
				for (int j = 0; j < n; ++j) {
					cout << a[j][i] << ' ';
				}
				cout << '\n';
			}
		}
	}
	return 0;
}


#include<bits/stdc++.h>
#define ll long long
#define mp make_pair
using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr); cout.tie(nullptr);
	int n, m;
	bool f = true;
	cin >> n >> m;
	if (n > m) f = false, swap(n, m);
	vector<vector<int> > a(n + m + 1, vector<int>(n + m + 1, 0));
	if (n == 1 && m == 1) cout << 1;
	else if (n == 1) {
		if (m < 4) cout << "-1";
		else if (m == 4) cout << "3 1 4 2";
		else {
			for (int i = 1; i <= n; i += 2) cout << i << ' ';
			for (int i = 2; i <= n; i += 2) cout << i << ' ';
		}
	}
	else if (m == 1) {
		if (n < 4) cout << "-1";
		else if (n == 4) cout << "3\n1\n4\n2";
		else {
			for (int i = 1; i <= n; i += 2) cout << i << '\n';
			for (int i = 2; i <= n; i += 2) cout << i << '\n';
		}
	}
	else if (n == 2 && m == 2) cout << "-1";
	else {
		int now = 1;
		pair<int, int> p = mp(0, 0);
		while (p.first + p.second < n + m) {
			auto tp = p;
			while (tp.first >= 0 && tp.second < m) {
				if (tp.second < m && tp.first < n) a[tp.first][tp.second] = now++;
				tp.first--, tp.second++;
			}
			p.first += 2;
		}
		p = mp(1, 0);
		while (p.first + p.second < n + m) {
			auto tp = p;
			while (tp.first >= 0 && tp.second < m) {
				if (tp.second < m && tp.first < n) a[tp.first][tp.second] = now++;
				tp.first--, tp.second++;
			}
			p.first += 2;
		}
		if (f) {
			for (int i = 0; i < n; ++i) {
				for (int j = 0; j < m; ++j) {
					cout << a[i][j] << ' ';
				}
				cout << '\n';
			}
		}
		else {
			for (int i = 0; i < m; ++i) {
				for (int j = 0; j < n; ++j) {
					cout << a[j][i] << ' ';
				}
				cout << '\n';
			}
		}
	}
	return 0;
}


#include<bits/stdc++.h>
#define ll long long
#define mp make_pair
using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr); cout.tie(nullptr);
	int n, m;
	bool f = true;
	cin >> n >> m;
	if (n > m) f = false, swap(n, m);
	vector<vector<int> > a(n + m + 1, vector<int>(n + m + 1, 0));
	if (n == 1 && m == 1) cout << 1;
	else if (n == 1) {
		if (m < 5) cout << "-1";
		else if (m == 4) cout << "3 1 4 2";
		else {
			for (int i = 1; i <= n; i += 2) cout << i << ' ';
			for (int i = 2; i <= n; i += 2) cout << i << ' ';
		}
	}
	else if (m == 1) {
		if (n < 5) cout << "-1";
		else if (n == 4) cout << "3\n1\n4\n2";
		else {
			for (int i = 1; i <= n; i += 2) cout << i << '\n';
			for (int i = 2; i <= n; i += 2) cout << i << '\n';
		}
	}
	else if (n == 2 && m == 2) cout << "-1";
	else {
		int now = 1;
		pair<int, int> p = mp(0, 0);
		while (p.first + p.second < n + m) {
			auto tp = p;
			while (tp.first >= 0 && tp.second < m) {
				if (tp.second < m && tp.first < n) a[tp.first][tp.second] = now++;
				tp.first--, tp.second++;
			}
			p.first += 2;
		}
		p = mp(1, 0);
		while (p.first + p.second < n + m) {
			auto tp = p;
			while (tp.first >= 0 && tp.second < m) {
				if (tp.second < m && tp.first < n) a[tp.first][tp.second] = now++;
				tp.first--, tp.second++;
			}
			p.first += 2;
		}
		if (f) {
			for (int i = 0; i < n; ++i) {
				for (int j = 0; j < m; ++j) {
					cout << a[i][j] << ' ';
				}
				cout << '\n';
			}
		}
		else {
			for (int i = 0; i < m; ++i) {
				for (int j = 0; j < n; ++j) {
					cout << a[j][i] << ' ';
				}
				cout << '\n';
			}
		}
	}
	return 0;
}


#include<bits/stdc++.h>
#define ll long long
#define mp make_pair
using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr); cout.tie(nullptr);
	int n, m;
	cin >> n >> m;
	vector<vector<int> > a(n, vector<int>(m, 0));
	if (n == 1) {
		if (m < 5) cout << "-1";
		else {
			for (int i = 1; i <= n; i += 2) cout << i << ' ';
			for (int i = 2; i <= n; i += 2) cout << i << ' ';
		}
	}
	else if (m == 1) {
		if (n < 5) cout << "-1";
		else {
			for (int i = 1; i <= n; i += 2) cout << i << '\n';
			for (int i = 2; i <= n; i += 2) cout << i << '\n';
		}
	}
	else if (n == 2 && m == 2) cout << "-1";
	else {
		a[0][0] = 1;
		for (int i = 1; i < m; ++i)
			a[0][i] = a[0][i - 1] + n - 1;
		for (int i = 1; i < n; ++i) {
			for (int j = 0; j < m; ++j) {
				a[i][j] = a[i - 1][j] + n;
			}
		}
		for (int i = 0; i < n; ++i) {
			for (int j = 0; j < m; ++j)
				cout << a[i][j] << ' ';
			cout << '\n';
		}
	}
	return 0;
}


#include<bits/stdc++.h>
#define ll long long
#define mp make_pair
using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr); cout.tie(nullptr);
	int n, m;
	bool f = true;
	cin >> n >> m;
	if (n > m&& m != 1) f = false, swap(n, m);
	vector<vector<int> > a(n + m + 1, vector<int>(n + m + 1, 0));
	if (n == 1 && m == 1) cout << 1;
	else if (n == 1) {
		if (m < 4) cout << "-1";
		else if (m == 4) cout << "3 1 4 2";
		else {
			for (int i = 1; i <= m; i += 2) cout << i << ' ';
			for (int i = 2; i <= m; i += 2) cout << i << ' ';
		}
	}
	else if (m == 1) {
		if (n < 4) cout << "-1";
		else if (n == 4) cout << "3\n1\n4\n2";
		else {
			for (int i = 1; i <= n; i += 2) cout << i << '\n';
			for (int i = 2; i <= n; i += 2) cout << i << '\n';
		}
	}
	else if (n == 2 && m == 2) cout << "-1";
	else {
		int now = 1;
		pair<int, int> p = mp(0, 0);
		while (p.first + p.second < n + m) {
			auto tp = p;
			while (tp.first >= 0 && tp.second < m) {
				if (tp.second < m && tp.first < n) a[tp.first][tp.second] = now++;
				tp.first--, tp.second++;
			}
			p.first += 2;
		}
		p = mp(1, 0);
		while (p.first + p.second < n + m) {
			auto tp = p;
			while (tp.first >= 0 && tp.second < m) {
				if (tp.second < m && tp.first < n) a[tp.first][tp.second] = now++;
				tp.first--, tp.second++;
			}
			p.first += 2;
		}
		if (f) {
			for (int i = 0; i < n; ++i) {
				for (int j = 0; j < m; ++j) {
					cout << a[i][j] << ' ';
				}
				cout << '\n';
			}
		}
		else {
			for (int i = 0; i < m; ++i) {
				for (int j = 0; j < n; ++j) {
					cout << a[j][i] << ' ';
				}
				cout << '\n';
			}
		}
	}
	return 0;
}


#include<bits/stdc++.h>
#define ll long long
#define mp make_pair
using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr); cout.tie(nullptr);
	int n, m;
	bool f = true;
	cin >> n >> m;
	if (n > m) f = false, swap(n, m);
	vector<vector<int> > a(n + m + 1, vector<int>(n + m + 1, 0));
	if (n == 1 && m == 1) cout << 1;
	else if (n == 1) {
		if (m < 5) cout << "-1";
		else {
			for (int i = 1; i <= n; i += 2) cout << i << ' ';
			for (int i = 2; i <= n; i += 2) cout << i << ' ';
		}
	}
	else if (m == 1) {
		if (n < 5) cout << "-1";
		else {
			for (int i = 1; i <= n; i += 2) cout << i << '\n';
			for (int i = 2; i <= n; i += 2) cout << i << '\n';
		}
	}
	else if (n == 2 && m == 2) cout << "-1";
	else {
		int now = 1;
		pair<int, int> p = mp(0, 0);
		while (p.first + p.second < n + m) {
			auto tp = p;
			while (tp.first >= 0 && tp.second < m) {
				if (tp.second < m && tp.first < n) a[tp.first][tp.second] = now++;
				tp.first--, tp.second++;
			}
			p.first += 2;
		}
		p = mp(1, 0);
		while (p.first + p.second < n + m) {
			auto tp = p;
			while (tp.first >= 0 && tp.second < m) {
				if (tp.second < m && tp.first < n) a[tp.first][tp.second] = now++;
				tp.first--, tp.second++;
			}
			p.first += 2;
		}
		if (f) {
			for (int i = 0; i < n; ++i) {
				for (int j = 0; j < m; ++j) {
					cout << a[i][j] << ' ';
				}
				cout << '\n';
			}
		}
		else {
			for (int i = 0; i < m; ++i) {
				for (int j = 0; j < n; ++j) {
					cout << a[j][i] << ' ';
				}
				cout << '\n';
			}
		}
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;

#define pb push_back
#define mod 998244353
#define lli long long int
#define mp make_pair
#define mt make_tuple
#define all(x) (x).begin(),(x).end()
#define ve vector<lli>
#define vep vector<pair<lli,lli> >
#define fr(i,a,n) for(lli i=a;i<(n);i++)
#define frx(i,a,n) for(lli i=a;i>(n);i--)
#define F first
#define S second
lli flag=0;
lli a[105][105];
void solve(lli min,lli max){
    if(max>4){
        flag=1;
        int j=0,k=1;
        for(j=0;2*j<max;j++) a[0][2*j]=j+1;
        for(;j<max;j+=1,k+=2)a[0][k]=j+1;

        fr(i,1,min){
            for(int j=0;j<max;j++){
                a[i][j]=a[i-1][j]+max;
            }
        }
    }
    if(max==4){
        flag=1;
        a[0][0]=3,a[0][1]=1,a[0][2]=4,a[0][3]=2;
        fr(i,1,min){
            for(int j=0;j<max;j++){
                a[i][j]=a[i-1][j]+max;
            }
        }

    }
    if(max==3){
        if(min==3){
            flag=1;
            a[0][0]=1,a[0][1]=6,a[0][2]=2,a[1][0]=7,a[1][1]=3,a[1][2]=8,a[2][0]=4,a[2][1]=9,a[2][2]=5;
        }
        if(min==2){
            flag=1;
            a[0][0]=1,a[0][1]=5,a[0][2]=3,a[1][0]=4,a[1][1]=2,a[1][2]=6;
        }
    }
    if(max==1 && min==1) a[0][0]=1,flag=1;
}

void display(lli min,lli max,lli t){
    if (flag){
        if(t){
            for(int j=0;j<max;j++){
                fr(i,0,min){
                    cout<<a[i][j]<<" ";
                }
                cout<<endl;
            }
        }
        else{
            fr(i,0,min){
                for(int j=0;j<max;j++){
                    cout<<a[i][j]<<" ";
                }
                cout<<endl;
            }
        }
    }
    else cout<<"-1";
}

int main(){
    lli n,m;
    cin>>n>>m;
    if(n<m){
        solve(n,m);
        display(n,m,0);
    }
    else{
        solve(m,n);
        display(m,n,1);
    }

}


#include<bits/stdc++.h>
using namespace std;

#define pb push_back
#define mod 998244353
#define lli long long int
#define mp make_pair
#define mt make_tuple
#define all(x) (x).begin(),(x).end()
#define ve vector<lli>
#define vep vector<pair<lli,lli> >
#define fr(i,a,n) for(lli i=a;i<(n);i++)
#define frx(i,a,n) for(lli i=a;i>(n);i--)
#define F first
#define S second
lli flag=0;
lli a[105][105];
void solve(lli min,lli max){
    if(max>4){
        flag=1;
        fr(i,0,max){
            if(i%2) a[0][i]=max/2+(i+1)/2+1;
            else a[0][i]=i/2+1;
        }
        fr(i,1,min){
            for(int j=0;j<max;j++){
                a[i][j]=a[i-1][j]+max;
            }
        }
    }
    if(max==4){
        flag=1;
        a[0][0]=3,a[0][1]=1,a[0][2]=4,a[0][3]=2;
        fr(i,1,min){
            for(int j=0;j<max;j++){
                a[i][j]=a[i-1][j]+max;
            }
        }

    }
    if(max==3){
        if(min==3){
            flag=1;
            a[0][0]=1,a[0][1]=6,a[0][2]=2,a[1][0]=7,a[1][1]=3,a[1][2]=8,a[2][0]=4,a[2][1]=9,a[2][2]=5;
        }
        if(min==2){
            flag=1;
            a[0][0]=1,a[0][1]=5,a[0][2]=3,a[1][0]=4,a[1][1]=2,a[1][2]=6;
        }
    }
}

void display(lli min,lli max,lli t){
    if (flag){
        if(t){
            for(int j=0;j<max;j++){
                fr(i,0,min){
                    cout<<a[i][j]<<" ";
                }
                cout<<endl;
            }
        }
        else{
            fr(i,0,min){
                for(int j=0;j<max;j++){
                    cout<<a[i][j]<<" ";
                }
                cout<<endl;
            }
        }
    }
    else cout<<"-1";
}

int main(){
    lli n,m;
    cin>>n>>m;
    if(n<m){
        solve(n,m);
        display(n,m,0);
    }
    else{
        solve(m,n);
        display(m,n,1);
    }

}


#include<bits/stdc++.h>
using namespace std;

#define pb push_back
#define mod 998244353
#define lli long long int
#define mp make_pair
#define mt make_tuple
#define all(x) (x).begin(),(x).end()
#define ve vector<lli>
#define vep vector<pair<lli,lli> >
#define fr(i,a,n) for(lli i=a;i<(n);i++)
#define frx(i,a,n) for(lli i=a;i>(n);i--)
#define F first
#define S second
lli flag=0;
lli a[105][105];
void solve(lli min,lli max){
    if(max>4){
        flag=1;
        fr(i,0,max){
            if(i%2) a[0][i]=max/2+(i+1)/2+1;
            else a[0][i]=i/2+1;
        }
        fr(i,1,min){
            for(int j=0;j<max;j++){
                a[i][j]=a[i-1][j]+max;
            }
        }
    }
    if(max==4){
        flag=1;
        a[0][0]=3,a[0][1]=1,a[0][2]=4,a[0][3]=2;
        fr(i,1,min){
            for(int j=0;j<max;j++){
                a[i][j]=a[i-1][j]+max;
            }
        }

    }
    if(max==3){
        if(min==3){
            flag=1;
            a[0][0]=1,a[0][1]=6,a[0][2]=2,a[1][0]=7,a[1][1]=3,a[1][2]=8,a[2][0]=4,a[2][1]=9,a[2][2]=5;
        }
        if(min==2){
            flag=1;
            a[0][0]=1,a[0][1]=5,a[0][2]=3,a[1][0]=4,a[1][1]=2,a[1][2]=6;
        }
    }
    if(max==1 && min==1) a[0][0]=1,flag=1;
}

void display(lli min,lli max,lli t){
    if (flag){
        if(t){
            for(int j=0;j<max;j++){
                fr(i,0,min){
                    cout<<a[i][j]<<" ";
                }
                cout<<endl;
            }
        }
        else{
            fr(i,0,min){
                for(int j=0;j<max;j++){
                    cout<<a[i][j]<<" ";
                }
                cout<<endl;
            }
        }
    }
    else cout<<"-1";
}

int main(){
    lli n,m;
    cin>>n>>m;
    if(n<m){
        solve(n,m);
        display(n,m,0);
    }
    else{
        solve(m,n);
        display(m,n,1);
    }

}


#include <cstdio>
#include <algorithm>
using namespace std;

const int Maxn = 105;

int n, m;
int B[Maxn][Maxn];

bool Check()
{
	for (int i = 0; i < n; i++)
		for (int j = 0; j < m; j++)
			if (i + 1 < n && abs(B[i][j] - B[i + 1][j]) == 1 ||
				j + 1 < m && abs(B[i][j] - B[i][j + 1]) == 1)
				return false;
	return true;
}

int main()
{
	scanf("%d %d", &n, &m);
	if (n == 1) {
		int cur = 0;
		for (int i = 2; i <= m; i += 2)
			B[0][cur++] = i;
		for (int i = 1; i <= m; i += 2)
			B[0][cur++] = i;
	} else if (m == 1) {
		int cur = 0;
		for (int i = 2; i <= n; i += 2)
			B[cur++][0] = i;
		for (int i = 1; i <= n; i += 2)
			B[cur++][0] = i;
	} else
		for (int j = 0; j < m; j++)
			for (int i = 0; i < n; i++)
				B[i][j] = j + (i + j) % n * m + 1;
	if (Check())
		for (int i = 0; i < n; i++)
			for (int j = 0; j < m; j++)
				printf("%d%c", B[i][j], j + 1 < m? ' ': '\n');
	else printf("-1\n");
	return 0;
}


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef vector<long long> vl;
typedef pair<long long , long long > pl;
#define po pop_back
#define pb push_back
#define mk make_pair
#define lw lower_bound
#define up upper_bound
#define ff first
#define ss second
#define boost ios_base::sync_with_stdio(); cin.tie(0); cout.tie(0);
#define MOD 1000000007
#define MAX 1e18
#define MIN -1e18
#define rep(i,a,b) for(ll i=a;i<=b;i++)
#define per(i,a,b) for(ll i=a;i>=b;i--)
#define con continue
#define freopen freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define PI 3.14159265358979323846264338327950288419716939937510582097494459230781640628
//typedef tree<ll , null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
template< typename T>
using indexed_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

ll cnt,T,sum,a,b,e1[1234567],e[1234567],c[1234567],d[1234567],c1[1000][1000],n,k,i,j,ans,x,y,l,r;
vector<ll> v[1234567];
bool used[1234567];
map<ll,ll> mp;
priority_queue<ll> pq;
string s,ss,s1[1234567];
pl p[1234567];
set<ll> st;
ll fac[123456],mod= 998244353;
vl vec;
char ch[1234][1234];
void end();
ll power(ll x, ll y);
ll C(ll x, ll y);
ll power1(ll x, ll y);
void dfs(ll x , ll y);
void dfs1(ll x,ll y);
struct node{
    ll x,y;
}str[1234567];
int main(){
    cin>>n>>k;
    if(n+k<5)end();
    x=n*k/2+1;
    y=1;
    rep(i,1,n){
        rep(j,1,k){
            if((i+j)%2==1)cout<<x<<" ",x++;
            else cout<<y<<" ",y++;
        }
        cout<<'\n';
    }
}

void end(){
    puts("-1");
    exit(0);
}
ll power(ll x , ll y){
    ans++;
    ll res = 1;
    if(y==1)return x;
    if(y==0)return 1;
    res=res*power(x,y/2)*power(x,y/2)%mod;
    if(y%2==1)res=res*x%mod;
    return res;
}
ll C(ll x,ll y){
    return ((fac[x] * power(fac[y] , MOD-2))%MOD) *power(fac[x-y] , MOD-2)%MOD;
}
ll power1(ll x , ll y){
    ll res = 1;
    while(y){
        if(y % 2){
            res = res * x % MOD;
        }
        x = x * x % MOD;
        y /= 2;
    }
    return res;
}
void dfs(ll x, ll y){
    for(auto u:v[x]){
        if(u!=y){
            e[u] = min(e[u] , e[x]);
            dfs(u,x);
        }
    }
}
void dfs1(ll x, ll y){
    for(auto u:v[x]){
        if(u!=y){
            dfs1(u,x);
            str[x].x+=str[u].x;
            str[x].y+=str[u].y;
        }
    }
    if(c[x]==1&&d[x]==0)str[x].x++;
    if(c[x]==0&&d[x]==1)str[x].y++;
    ll mn=min(str[x].x,str[x].y);
    ans+=mn*2*e[x];
    str[x].x-=mn;
    str[y].y-=mn;
}


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef vector<long long> vl;
typedef pair<long long , long long > pl;
#define po pop_back
#define pb push_back
#define mk make_pair
#define lw lower_bound
#define up upper_bound
#define ff first
#define ss second
#define boost ios_base::sync_with_stdio(); cin.tie(0); cout.tie(0);
#define MOD 1000000007
#define MAX 1e18
#define MIN -1e18
#define rep(i,a,b) for(ll i=a;i<=b;i++)
#define per(i,a,b) for(ll i=a;i>=b;i--)
#define con continue
#define freopen freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define PI 3.14159265358979323846264338327950288419716939937510582097494459230781640628
//typedef tree<ll , null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
template< typename T>
using indexed_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

ll cnt,T,sum,a,b,e1[1234567],e[1234567],c[1234567],d[1234567],c1[1000][1000],n,k,i,j,ans,x,y,l,r;
vector<ll> v[1234567];
bool used[1234567];
map<ll,ll> mp;
priority_queue<ll> pq;
string s,ss,s1[1234567];
pl p[1234567];
set<ll> st;
ll fac[123456],mod= 998244353;
vl vec;
char ch[1234][1234];
void end();
ll power(ll x, ll y);
ll C(ll x, ll y);
ll power1(ll x, ll y);
void dfs(ll x , ll y);
void dfs1(ll x,ll y);
struct node{
    ll x,y;
}str[1234567];
int main(){
    cin>>n>>k;
    if(n+k<5)end();
    x=n*k/2+1;
    y=1;
    rep(i,1,n){
        rep(j,1,k){
            if(i+j%2==1)cout<<x<<" ",x++;
            else cout<<y<<" ",y++;
        }
        cout<<'\n';
    }
}

void end(){
    puts("-1");
    exit(0);
}
ll power(ll x , ll y){
    ans++;
    ll res = 1;
    if(y==1)return x;
    if(y==0)return 1;
    res=res*power(x,y/2)*power(x,y/2)%mod;
    if(y%2==1)res=res*x%mod;
    return res;
}
ll C(ll x,ll y){
    return ((fac[x] * power(fac[y] , MOD-2))%MOD) *power(fac[x-y] , MOD-2)%MOD;
}
ll power1(ll x , ll y){
    ll res = 1;
    while(y){
        if(y % 2){
            res = res * x % MOD;
        }
        x = x * x % MOD;
        y /= 2;
    }
    return res;
}
void dfs(ll x, ll y){
    for(auto u:v[x]){
        if(u!=y){
            e[u] = min(e[u] , e[x]);
            dfs(u,x);
        }
    }
}
void dfs1(ll x, ll y){
    for(auto u:v[x]){
        if(u!=y){
            dfs1(u,x);
            str[x].x+=str[u].x;
            str[x].y+=str[u].y;
        }
    }
    if(c[x]==1&&d[x]==0)str[x].x++;
    if(c[x]==0&&d[x]==1)str[x].y++;
    ll mn=min(str[x].x,str[x].y);
    ans+=mn*2*e[x];
    str[x].x-=mn;
    str[y].y-=mn;
}


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef vector<long long> vl;
typedef pair<long long , long long > pl;
#define po pop_back
#define pb push_back
#define mk make_pair
#define lw lower_bound
#define up upper_bound
#define ff first
#define ss second
#define boost ios_base::sync_with_stdio(); cin.tie(0); cout.tie(0);
#define MOD 1000000007
#define MAX 1e18
#define MIN -1e18
#define rep(i,a,b) for(ll i=a;i<=b;i++)
#define per(i,a,b) for(ll i=a;i>=b;i--)
#define con continue
#define freopen freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define PI 3.14159265358979323846264338327950288419716939937510582097494459230781640628
//typedef tree<ll , null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
template< typename T>
using indexed_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

ll cnt,T,sum,a,b,e1[1234567],e[1234567],c[1234567],d[1234567],c1[1000][1000],n,k,i,j,ans,x,y,l,r;
vector<ll> v[1234567];
bool used[1234567];
map<ll,ll> mp;
priority_queue<ll> pq;
string s,ss,s1[1234567];
pl p[1234567];
set<ll> st;
ll fac[123456],mod= 998244353;
vl vec;
char ch[1234][1234];
void end();
ll power(ll x, ll y);
ll C(ll x, ll y);
ll power1(ll x, ll y);
void dfs(ll x , ll y);
void dfs1(ll x,ll y);
struct node{
    ll x,y;
}str[1234567];
int main(){
    cin>>n>>k;
    if(n==1&&k==1){
        cout<<1;
        exit(0);
    }
    if(n+k<5)end();
    x=n*k/2+1;
    y=1;
    rep(i,1,n){
        rep(j,1,k){
            if((i+j)%2==0)cout<<x<<" ",x++;
            else cout<<y<<" ",y++;
        }
        cout<<'\n';
    }
}

void end(){
    puts("-1");
    exit(0);
}
ll power(ll x , ll y){
    ans++;
    ll res = 1;
    if(y==1)return x;
    if(y==0)return 1;
    res=res*power(x,y/2)*power(x,y/2)%mod;
    if(y%2==1)res=res*x%mod;
    return res;
}
ll C(ll x,ll y){
    return ((fac[x] * power(fac[y] , MOD-2))%MOD) *power(fac[x-y] , MOD-2)%MOD;
}
ll power1(ll x , ll y){
    ll res = 1;
    while(y){
        if(y % 2){
            res = res * x % MOD;
        }
        x = x * x % MOD;
        y /= 2;
    }
    return res;
}


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef vector<long long> vl;
typedef pair<long long , long long > pl;
#define po pop_back
#define pb push_back
#define mk make_pair
#define lw lower_bound
#define up upper_bound
#define ff first
#define ss second
#define boost ios_base::sync_with_stdio(); cin.tie(0); cout.tie(0);
#define MOD 1000000007
#define MAX 1e18
#define MIN -1e18
#define rep(i,a,b) for(ll i=a;i<=b;i++)
#define per(i,a,b) for(ll i=a;i>=b;i--)
#define con continue
#define freopen freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define PI 3.14159265358979323846264338327950288419716939937510582097494459230781640628
//typedef tree<ll , null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
template< typename T>
using indexed_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

ll cnt,T,sum,a,b,e1[1234567],e[1234567],c[1234567],d[1234567],c1[1000][1000],n,k,i,j,ans,x,y,l,r;
vector<ll> v[1234567];
bool used[1234567];
map<ll,ll> mp;
priority_queue<ll> pq;
string s,ss,s1[1234567];
pl p[1234567];
set<ll> st;
ll fac[123456],mod= 998244353;
vl vec;
char ch[1234][1234];
void end();
ll power(ll x, ll y);
ll C(ll x, ll y);
ll power1(ll x, ll y);
void dfs(ll x , ll y);
void dfs1(ll x,ll y);
struct node{
    ll x,y;
}str[1234567];
int main(){
    cin>>n>>k;
    if(n+k<5)end();
    x=n*k/2+1;
    y=1;
    rep(i,1,n){
        rep(j,1,k){
            if((i+j)%2==0)cout<<x<<" ",x++;
            else cout<<y<<" ",y++;
        }
        cout<<'\n';
    }
}

void end(){
    puts("-1");
    exit(0);
}
ll power(ll x , ll y){
    ans++;
    ll res = 1;
    if(y==1)return x;
    if(y==0)return 1;
    res=res*power(x,y/2)*power(x,y/2)%mod;
    if(y%2==1)res=res*x%mod;
    return res;
}
ll C(ll x,ll y){
    return ((fac[x] * power(fac[y] , MOD-2))%MOD) *power(fac[x-y] , MOD-2)%MOD;
}
ll power1(ll x , ll y){
    ll res = 1;
    while(y){
        if(y % 2){
            res = res * x % MOD;
        }
        x = x * x % MOD;
        y /= 2;
    }
    return res;
}
void dfs(ll x, ll y){
    for(auto u:v[x]){
        if(u!=y){
            e[u] = min(e[u] , e[x]);
            dfs(u,x);
        }
    }
}
void dfs1(ll x, ll y){
    for(auto u:v[x]){
        if(u!=y){
            dfs1(u,x);
            str[x].x+=str[u].x;
            str[x].y+=str[u].y;
        }
    }
    if(c[x]==1&&d[x]==0)str[x].x++;
    if(c[x]==0&&d[x]==1)str[x].y++;
    ll mn=min(str[x].x,str[x].y);
    ans+=mn*2*e[x];
    str[x].x-=mn;
    str[y].y-=mn;
}


#include<bits/stdc++.h>
// use gp_hash_table<int,int,custom_hash> m;
// in place of map
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define rep(i,n) for(int i=0;i<n;++i)
#define repa(i,a,n) for(int i=a;i<n;++i)
#define repr(i,n) for(int i=n-1;i>=0;--i)
#define repba(i,b,a) for(int i=b;i>=a;--i)
#define repab(i,a,b) for(int i=a;i<b;++i)
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define msi map<string,int>
#define mii map<int,int>
#define viip vector<pair<int,pair<int,int> > >
#define mp make_pair
#define vip vector<pair<int,int> >
#define pb push_back
#define po pop_back
#define fi first
#define sec second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define s(v) v.size()
ll mod = 1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());//use rng()%n for numbers in range [0,n-1]
// This custom_hash is for unordered_map
// use map<int, int, custom_hash> mp;

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
ll gcd(ll a,ll b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	#ifndef ONLINE_JUDGE
    	freopen("input.txt", "r", stdin);
    	freopen("output.txt", "w", stdout);
	#endif
	int n,m;
	cin>>n>>m;
	int n1 = max(n,m);
	int m1 = min(n,m);
	int a[n1][m1];
	if(n1 >= 4){
		deque<int> d;
		d.pb(3);
		d.pb(1);
		d.pb(4);
		d.pb(2);
		rep(i,n1-4){
			if(i%2==0)d.pb(i+5);
			else d.push_front(i+5);
		}

		rep(i,n1){
			int x = d.back();
			d.pop_back();
			a[i][0] = x;
 		}
 		repa(j,1,m1){
 			rep(i,n1){
 				a[i][j] = a[i][0]+j*n1;
 			}
 		}
 		if(n >= m){
 			// cout<<"a";
 			rep(i,n){
 				rep(j,m){
 					cout<<a[i][j]<<" ";
 				}
 				cout<<"\n";
 			}
 		}
 		else{
 			rep(i,n){
 				rep(j,m){
 					cout<<a[j][i]<<" ";
 				}
 				cout<<"\n";
 			}
 		}
 		// rep(i,n1)
	}
	else if(n1 == 3 && m1 == 3){
		cout<<"8 6 2\n3 1 9\n5 7 4\n";
		// return 0;
	}
	else if(n1 == 3 && m1 == 2){
		cout<<"3 6 2\n5 1 4\n";
	}
	else{
		cout<<-1;
		// return 0;
	}
	return 0;
}


#include<bits/stdc++.h>
// use gp_hash_table<int,int,custom_hash> m;
// in place of map
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define rep(i,n) for(int i=0;i<n;++i)
#define repa(i,a,n) for(int i=a;i<n;++i)
#define repr(i,n) for(int i=n-1;i>=0;--i)
#define repba(i,b,a) for(int i=b;i>=a;--i)
#define repab(i,a,b) for(int i=a;i<b;++i)
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define msi map<string,int>
#define mii map<int,int>
#define viip vector<pair<int,pair<int,int> > >
#define mp make_pair
#define vip vector<pair<int,int> >
#define pb push_back
#define po pop_back
#define fi first
#define sec second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define s(v) v.size()
ll mod = 1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());//use rng()%n for numbers in range [0,n-1]
// This custom_hash is for unordered_map
// use map<int, int, custom_hash> mp;

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
ll gcd(ll a,ll b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	#ifndef ONLINE_JUDGE
    	freopen("input.txt", "r", stdin);
    	freopen("output.txt", "w", stdout);
	#endif
	int n,m;
	cin>>n>>m;
	int n1 = max(n,m);
	int m1 = min(n,m);
	int a[n1][m1];
	if(n1 >= 4){
		deque<int> d;
		d.pb(3);
		d.pb(1);
		d.pb(4);
		d.pb(2);
		rep(i,n1-4){
			if(i%2==0)d.pb(i+5);
			else d.push_front(i+5);
		}

		rep(i,n1){
			int x = d.back();
			d.pop_back();
			a[i][0] = x;
 		}
 		repa(j,1,m1){
 			rep(i,n1){
 				a[i][j] = a[i][0]+j*n1;
 			}
 		}
 		if(n >= m){
 			// cout<<"a";
 			rep(i,n){
 				rep(j,m){
 					cout<<a[i][j]<<" ";
 				}
 				cout<<"\n";
 			}
 		}
 		else{
 			rep(i,n){
 				rep(j,m){
 					cout<<a[j][i]<<" ";
 				}
 				cout<<"\n";
 			}
 		}
 		// rep(i,n1)
	}
	else if(n1 == 3 && m1 == 3){
		cout<<"8 6 2\n3 1 9\n5 7 4\n";
		// return 0;
	}
	else if(n == 2 && m == 3){
		cout<<"3 6 2\n5 1 4\n";
	}
	else if(n == 3 && m == 2){
		cout<<"3 5\n6 1\n2 4\n";
	}
	else if(n1 == 1 && m1 == 1){
		cout<<"1\n";
	}
	else{
		cout<<-1;
		// return 0;
	}
	return 0;
}


#include<bits/stdc++.h>
// use gp_hash_table<int,int,custom_hash> m;
// in place of map
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define rep(i,n) for(int i=0;i<n;++i)
#define repa(i,a,n) for(int i=a;i<n;++i)
#define repr(i,n) for(int i=n-1;i>=0;--i)
#define repba(i,b,a) for(int i=b;i>=a;--i)
#define repab(i,a,b) for(int i=a;i<b;++i)
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define msi map<string,int>
#define mii map<int,int>
#define viip vector<pair<int,pair<int,int> > >
#define mp make_pair
#define vip vector<pair<int,int> >
#define pb push_back
#define po pop_back
#define fi first
#define sec second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define s(v) v.size()
ll mod = 1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());//use rng()%n for numbers in range [0,n-1]
// This custom_hash is for unordered_map
// use map<int, int, custom_hash> mp;

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
ll gcd(ll a,ll b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	#ifndef ONLINE_JUDGE
    	freopen("input.txt", "r", stdin);
    	freopen("output.txt", "w", stdout);
	#endif
	int n,m;
	cin>>n>>m;
	int n1 = max(n,m);
	int m1 = min(n,m);
	int a[n1][m1];
	if(n1 >= 4){
		deque<int> d;
		d.pb(3);
		d.pb(1);
		d.pb(4);
		d.pb(2);
		rep(i,n1-4){
			if(i%2==0)d.pb(i+5);
			else d.push_front(i+5);
		}

		rep(i,n1){
			int x = d.back();
			d.pop_back();
			a[i][0] = x;
 		}
 		repa(j,1,m1){
 			rep(i,n1){
 				a[i][j] = a[i][0]+j*n1;
 			}
 		}
 		if(n >= m){
 			// cout<<"a";
 			rep(i,n){
 				rep(j,m){
 					cout<<a[i][j]<<" ";
 				}
 				cout<<"\n";
 			}
 		}
 		else{
 			rep(i,n){
 				rep(j,m){
 					cout<<a[j][i]<<" ";
 				}
 				cout<<"\n";
 			}
 		}
 		// rep(i,n1)
	}
	else if(n1 == 3 && m1 == 3){
		cout<<"8 6 2\n3 1 9\n5 7 4\n";
		// return 0;
	}
	else if(n == 3 && m == 2){
		cout<<"3 6 2\n5 1 4\n";
	}
	else if(n == 2 && m == 3){
		cout<<"3 5\n6 1\n2 4\n";
	}
	else if(n1 == 1 && m1 == 1){
		cout<<"1\n";
	}
	else{
		cout<<-1;
		// return 0;
	}
	return 0;
}


#include<bits/stdc++.h>
// use gp_hash_table<int,int,custom_hash> m;
// in place of map
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define rep(i,n) for(int i=0;i<n;++i)
#define repa(i,a,n) for(int i=a;i<n;++i)
#define repr(i,n) for(int i=n-1;i>=0;--i)
#define repba(i,b,a) for(int i=b;i>=a;--i)
#define repab(i,a,b) for(int i=a;i<b;++i)
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define msi map<string,int>
#define mii map<int,int>
#define viip vector<pair<int,pair<int,int> > >
#define mp make_pair
#define vip vector<pair<int,int> >
#define pb push_back
#define po pop_back
#define fi first
#define sec second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define s(v) v.size()
ll mod = 1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());//use rng()%n for numbers in range [0,n-1]
// This custom_hash is for unordered_map
// use map<int, int, custom_hash> mp;

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
ll gcd(ll a,ll b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	#ifndef ONLINE_JUDGE
    	freopen("input.txt", "r", stdin);
    	freopen("output.txt", "w", stdout);
	#endif
	int n,m;
	cin>>n>>m;
	int n1 = max(n,m);
	int m1 = min(n,m);
	int a[n1][m1];
	if(n1 >= 4){
		deque<int> d;
		d.pb(3);
		d.pb(1);
		d.pb(4);
		d.pb(2);
		rep(i,n1-4){
			if(i%2==0)d.pb(i+5);
			else d.push_front(i+5);
		}

		rep(i,n1){
			int x = d.back();
			d.pop_back();
			a[i][0] = x;
 		}
 		repa(j,1,m1){
 			rep(i,n1){
 				a[i][j] = a[i][0]+j*n1;
 			}
 		}
 		if(n >= m){
 			// cout<<"a";
 			rep(i,n){
 				rep(j,m){
 					cout<<a[i][j]<<" ";
 				}
 				cout<<"\n";
 			}
 		}
 		else{
 			rep(i,n){
 				rep(j,m){
 					cout<<a[j][i]<<" ";
 				}
 				cout<<"\n";
 			}
 		}
 		// rep(i,n1)
	}
	else if(n1 == 3 && m1 == 3){
		cout<<"8 6 2\n3 1 9\n5 7 4\n";
		// return 0;
	}
	else if(n1 == 3 && m1 == 2){
		cout<<"3 6 2\n5 1 4\n";
	}
	else if(n1 == 1 && m1 == 1){
		cout<<"1\n";
	}
	else{
		cout<<-1;
		// return 0;
	}
	return 0;
}


#include <bits/stdc++.h>

#define F first
#define S second
#define pb push_back
#define ll long long

using namespace std;

int main() {
    ios_base::sync_with_stdio( 0 );
#ifdef LOCAL
    freopen( "input.txt", "r", stdin );
    freopen( "output.txt", "w", stdout );
#endif //LOCAL
    int n,m;
    cin>>n>>m;
    if ( n*m == 1 ) {
        cout<<1<<endl;
        return 0;
    }
    if ( n*m < 4 ) {
        cout<<-1<<endl;
        return 0;
    }
    int x = 1;
    int y = ( n*m ) / 2 + 1;
    for ( int i = 0; i < n; i++ ) {
        for ( int j = 0; j < m; j++ ) {
            if ( (i+j) % 2 == 0 ) cout<<y++<<' ';
                else cout<<x++<<' ';
        }
        cout<<endl;
    }
    return 0;
}


#include <bits/stdc++.h>

#define F first
#define S second
#define pb push_back
#define ll long long

using namespace std;

int main() {
    ios_base::sync_with_stdio( 0 );
#ifdef LOCAL
    freopen( "input.txt", "r", stdin );
    freopen( "output.txt", "w", stdout );
#endif //LOCAL
    int n,m;
    cin>>n>>m;
    if ( n*m == 1 ) {
        cout<<1<<endl;
        return 0;
    }
    if ( n+m < 5 ) {
        cout<<-1<<endl;
        return 0;
    }
    int x = 1;
    int y = ( n*m ) / 2 + 1;
    for ( int i = 0; i < n; i++ ) {
        for ( int j = 0; j < m; j++ ) {
            if ( (i+j) % 2 == 0 ) cout<<y++<<' ';
                else cout<<x++<<' ';
        }
        cout<<endl;
    }
    return 0;
}


import java.util.Scanner;

public class j45 {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		// while (true) {
		int rows = in.nextInt();
		int cols = in.nextInt();

		boolean flip = false;
		if (rows > cols) {
			flip = true;
			int t = rows;
			rows = cols;
			cols = t;
		}
		if (rows * cols <= 3 || (rows == 2 && cols == 2)) {
			System.out.println(-1);
			return;
			// continue;
		}

		int[][] ans;
		if (rows == 2 && cols == 3) {
			ans = new int[][] { { 3, 6, 2 }, { 5, 1, 4 } };
		} else if (rows == 3 && cols == 3) {
			ans = new int[][] { { 2, 4, 6 }, { 5, 1, 9 }, { 8, 3, 7 } };
		} else {
			counter = 0;
			ans = new int[rows][cols];
			fill(ans, 1 - (cols % 2));
			fill(ans, cols % 2);
		}
		print(ans, flip);
		// }
	}

	static int counter;

	private static void fill(int[][] ans, int i) {
		for (int j = 0; j < ans.length; j++) {
			for (int k = i; k < ans[j].length; k += 2) {
				ans[j][k] = ++counter;
			}
		}
	}

	private static void print(int[][] ans, boolean flip) {
		int outer = flip ? ans[0].length : ans.length;
		int inner = flip ? ans.length : ans[0].length;

		for (int i = 0; i < outer; i++) {
			for (int j = 0; j < inner; j++) {
				System.out.printf("%d ", flip ? ans[j][i] : ans[i][j]);
			}
			System.out.println();
		}
	}
}


import java.util.Scanner;

public class j45 {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		// while (true) {
		int rows = in.nextInt();
		int cols = in.nextInt();

		boolean flip = false;
		if (rows > cols) {
			flip = true;
			int t = rows;
			rows = cols;
			cols = t;
		}
		if (rows * cols == 1) {
			System.out.println(1);
			return;
		} else if (rows * cols <= 3 || (rows == 2 && cols == 2)) {
			System.out.println(-1);
			return;
			// continue;
		}

		int[][] ans;
		if (rows == 2 && cols == 3) {
			ans = new int[][] { { 3, 6, 2 }, { 5, 1, 4 } };
		} else if (rows == 3 && cols == 3) {
			ans = new int[][] { { 2, 4, 6 }, { 5, 1, 9 }, { 8, 3, 7 } };
		} else {
			counter = 0;
			ans = new int[rows][cols];
			fill(ans, 1 - (cols % 2));
			fill(ans, cols % 2);
		}
		print(ans, flip);
		// }
	}

	static int counter;

	private static void fill(int[][] ans, int i) {
		for (int j = 0; j < ans.length; j++) {
			for (int k = i; k < ans[j].length; k += 2) {
				ans[j][k] = ++counter;
			}
		}
	}

	private static void print(int[][] ans, boolean flip) {
		int outer = flip ? ans[0].length : ans.length;
		int inner = flip ? ans.length : ans[0].length;

		for (int i = 0; i < outer; i++) {
			for (int j = 0; j < inner; j++) {
				System.out.printf("%d ", flip ? ans[j][i] : ans[i][j]);
			}
			System.out.println();
		}
	}
}


import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.util.ArrayDeque;
import java.io.PrintWriter;
import java.util.TreeSet;
import java.util.AbstractCollection;
import java.util.StringTokenizer;
import java.util.Collection;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Zyflair Griffane
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		PandaScanner in = new PandaScanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		J solver = new J();
		solver.solve(1, in, out);
		out.close();
	}
}

class J {
    public void solve(int testNumber, PandaScanner in, PrintWriter out) {
        int h = in.nextInt();
        int w = in.nextInt();
        if (h * w == 1) {
            out.println(1);
            return;
        }
        if (Math.max(h, w) < 3 || h * w < 3) {
            out.println(-1);
            return;
        }
        int[][] res = new int[h][w];
        ArrayDeque<Integer> lst = new ArrayDeque<>();
        for (int start = 2; start >= 1; start--) {
            ArrayDeque<Integer> q = new ArrayDeque<>();
            int curr = start;
            while (curr <= h * w) {
                q.addLast(curr);
                curr += 2;
            }
            if (h == 2 && start == 1) {
                q.addFirst(q.pollLast());
            }
            lst.addAll(q);
        }
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                res[i][j] = lst.poll();
            }
            out.println(ArrayUtil.toString(res[i]));
        }
    }
}

class PandaScanner {
    public BufferedReader br;
    public StringTokenizer st;
    public InputStream in;

    public PandaScanner(InputStream in) {
        br = new BufferedReader(new InputStreamReader(this.in = in));
    }

    public String nextLine() {
        try {
            return br.readLine();
        }
        catch (Exception e) {
            return null;
        }
    }

    public String next() {
        if (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(nextLine().trim());
            return next();
        }
        return st.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    }

class ArrayUtil {

    public static<T> String toString(int[] arr) {
        StringBuilder res = new StringBuilder();
        for (int i: arr) {
            res.append(i);
            res.append(' ');
        }
        return res.toString();
    }

    }


import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.util.ArrayDeque;
import java.io.PrintWriter;
import java.util.TreeSet;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Zyflair Griffane
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		PandaScanner in = new PandaScanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		J solver = new J();
		solver.solve(1, in, out);
		out.close();
	}
}

class J {
    public void solve(int testNumber, PandaScanner in, PrintWriter out) {
        int h = in.nextInt();
        int w = in.nextInt();
        if (Math.max(h, w) < 3 || h * w < 3) {
            out.println(-1);
            return;
        }
        int[][] res = new int[h][w];
        ArrayDeque<Integer> q = new ArrayDeque<>();
        for (int start = 2; start >= 1; start--) {
            int curr = start;
            while (curr <= h * w) {
                if (h == 2 && start == 1) {
                    q.addFirst(curr);
                }
                else {
                    q.addLast(curr);
                }
                curr += 2;
            }
        }
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                res[i][j] = q.poll();
            }
            out.println(ArrayUtil.toString(res[i]));
        }
    }
}

class PandaScanner {
    public BufferedReader br;
    public StringTokenizer st;
    public InputStream in;

    public PandaScanner(InputStream in) {
        br = new BufferedReader(new InputStreamReader(this.in = in));
    }

    public String nextLine() {
        try {
            return br.readLine();
        }
        catch (Exception e) {
            return null;
        }
    }

    public String next() {
        if (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(nextLine().trim());
            return next();
        }
        return st.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    }

class ArrayUtil {

    public static<T> String toString(int[] arr) {
        StringBuilder res = new StringBuilder();
        for (int i: arr) {
            res.append(i);
            res.append(' ');
        }
        return res.toString();
    }

    }


import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.util.ArrayDeque;
import java.io.PrintWriter;
import java.util.TreeSet;
import java.util.AbstractCollection;
import java.util.StringTokenizer;
import java.util.Collection;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Zyflair Griffane
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		PandaScanner in = new PandaScanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		J solver = new J();
		solver.solve(1, in, out);
		out.close();
	}
}

class J {
    public void solve(int testNumber, PandaScanner in, PrintWriter out) {
        int h = in.nextInt();
        int w = in.nextInt();
        if (Math.max(h, w) < 3 || h * w < 3) {
            out.println(-1);
            return;
        }
        int[][] res = new int[h][w];
        ArrayDeque<Integer> lst = new ArrayDeque<>();
        for (int start = 2; start >= 1; start--) {
            ArrayDeque<Integer> q = new ArrayDeque<>();
            int curr = start;
            while (curr <= h * w) {
                q.addLast(curr);
                curr += 2;
            }
            if (h == 2 && start == 1) {
                q.addFirst(q.pollLast());
            }
            lst.addAll(q);
        }
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                res[i][j] = lst.poll();
            }
            out.println(ArrayUtil.toString(res[i]));
        }
    }
}

class PandaScanner {
    public BufferedReader br;
    public StringTokenizer st;
    public InputStream in;

    public PandaScanner(InputStream in) {
        br = new BufferedReader(new InputStreamReader(this.in = in));
    }

    public String nextLine() {
        try {
            return br.readLine();
        }
        catch (Exception e) {
            return null;
        }
    }

    public String next() {
        if (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(nextLine().trim());
            return next();
        }
        return st.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    }

class ArrayUtil {

    public static<T> String toString(int[] arr) {
        StringBuilder res = new StringBuilder();
        for (int i: arr) {
            res.append(i);
            res.append(' ');
        }
        return res.toString();
    }

    }