leaps = [
[1,-2],
[2,-1],
[2,1],
[1,2],
[-1,2],
[-2,1],
[-2,-1],
[-1,-2]
]

def getNextEmptyInLine(x,y,h,w):
    max=h*w
    pos=y*w+x
    while pos<max:
        y1=pos//w
        x1=pos%w
        if table [x1][y1]==0:
            return(x1,y1)
        pos = pos +1
    return(None,None)

def jumpToNext(x,y,h,w):
    for coord in leaps:
        x1=x+coord[0]
        y1=y+coord[1]
        if (x1>=0 and x1<w and y1>=0 and y1<h):
            if table[x1][y1]==0:
                return(x1,y1)
    return(None,None)

def getNextEmpty(x,y,h,w):
    (x1,y1)=jumpToNext(x,y,h,w)
    if x1 is None:
        (x1,y1)=getNextEmptyInLine(x,y,h,w)
        if x1 is None:
            (x1,y1)=getNextEmptyInLine(0,0,h,w)
    return(x1,y1)

def printTable(table,w,h):
    for i in range(h):
        for j in range(w):
            print(format % (table[j][i]), end =" ")
        print("")

buffer = []
while True:
    line = input().rstrip('\n')
    buffer.append(line)
    if(len(buffer)==1):
        break

numbers = buffer[0].split()
height = int(numbers[0])
width = int(numbers[1])
max = height*width
maxstr = str(max)
length = len(maxstr)
format = "%"+str(length)+"d"

table=[ [0]*height for i in range(width)]

x=0
y=0
table[x][y]=1
for i in range(max-1):
    (x,y)=getNextEmpty(x,y,height,width)
    if x is not None:
       table[x][y]=i+2
    else:
        break 

printTable(table,width,height)

