python3
a,b=map(int,input().split()) k = 1 for i in range(a): for j in range(b): if j == b-1: print("PUM") else: print(k,end=' ') k+=1