#include using namespace std; #ifdef TEMPURA #else #define debug(...) ((void)0) #define msg(...) ((void)0) #endif #define rep(i, n) for(int i = 0; i < (int)(n); i++) #define REP(i, m, n) for(int i = (int)(m); i < (int)(n); i++) using ll = long long; using ull = unsigned long long; using i128 = __int128_t; template inline bool chmin(T &a, T b) { if(a > b) { a = b; return true; } return false; } template inline bool chmax(T &a, T b) { if(a < b) { a = b; return true; } return false; } // #include // using mint = atcoder::modint998244353; vector create_permutation(int n) { assert(n % 2 == 0); int b = 0; while((1 << (b + 1)) <= n) { b += 1; } vector ret; int cur = 0; rep(i, (1 << b)) { ret.push_back(cur); if(i % 2 == 0) { if((cur ^ (1 << b)) < n) { ret.push_back(cur ^ (1 << b)); ret.push_back(cur ^ (1 << b) ^ 1); } } int c = countr_zero(unsigned(i + 1)); cur ^= 1 << c; } debug(ret); return ret; } int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int h, w; cin >> h >> w; if(h % 2 == 1 || w % 2 == 1) { cout << -1 << endl; return 0; } auto vh = create_permutation(h), vw = create_permutation(w); int bh = 32 - countl_zero(unsigned(h - 1)), bw = 32 - countl_zero(unsigned(w - 1)); vector ord(bh + bw); rep(i, bw) ord[bh + i] = 1; int ma = 1 << 30; vector best; do { int ch = 0, cw = 0; int res = 0; for(auto e : ord) { if(e == 0) { res |= ((h - 1) >> ch & 1) << (ch + cw); ch += 1; } else { res |= ((w - 1) >> cw & 1) << (ch + cw); cw += 1; } } if(res < ma) { ma = res; best = ord; } } while(next_permutation(ord.begin(), ord.end())); rep(i, h) rep(j, w) { int ch = 0, cw = 0; int res = 0; for(auto e : best) { if(e == 0) { res |= (vh[i] >> ch & 1) << (ch + cw); ch += 1; } else { res |= (vw[j] >> cw & 1) << (ch + cw); cw += 1; } } cout << res << " \n"[j + 1 == w]; } return 0; }