#include <bits/stdc++.h>

int main() {
    freopen("field.in", "r", stdin);
    freopen("field.out", "w", stdout);
    int n, m;
    scanf("%d%d", &n, &m);
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            printf("%d%c", (3 * i + j) % 5, " \n"[j == m - 1]);
        }
    }
    return 0;
}