#include <iostream>
using namespace std;
int main() {
int k, l;
cin >> k >> l;
int a[k][l];
for(int i = 0; i < k; i++)
{
for(int j = 0; j < l; j++)
{
a[i][j] = (j + 2 * (i % 2)) % 4 + 1;
cout << a[i][j] << " ";
}
cout << "\n";
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7CglpbnQgaywgbDsKCWNpbiA+PiBrID4+IGw7CglpbnQgYVtrXVtsXTsKCglmb3IoaW50IGkgPSAwOyBpIDwgazsgaSsrKQoJewoJCQlmb3IoaW50IGogPSAwOyBqIDwgbDsgaisrKQoJCQl7CgkJCQlhW2ldW2pdID0gKGogKyAyICogKGkgJSAyKSkgJSA0ICsgMTsKCQkJCWNvdXQgPDwgYVtpXVtqXSA8PCAiICI7CgkJCX0gIAoJCWNvdXQgPDwgIlxuIjsKCX0KCXJldHVybiAwOwp9