a=int(input("enter the row"))
b=int(input("enter the colomn"))
k=1
for i in range(a):
    for j in range(b):
    
        print(k,end=' ')
        k=k+1
       
    print(' ')

a=int(input("enter the row"))
b=int(input("enter the colomn"))
k=1
for i in range(a):
    for j in range(b):
    
        print(k,end=' ')
        k=k+1
       
    print(' ')
