n, m = map(int, input().split())
N = 1<<n
M = 1<<m
a = [[0]*M for _ in range(N)]
for i in range(N):
    for j in range(M):
        a[i][j] = i * M + j

for r in a:
    print(*r)