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