There are n parliamentarians in Berland. They are numbered with integers from 1 to n. It happened that all parliamentarians with odd indices are Democrats and all parliamentarians with even indices are Republicans.

New parliament assembly hall is a rectangle consisting of a × b chairs — a rows of b chairs each. Two chairs are considered neighbouring if they share as side. For example, chair number 5 in row number 2 is neighbouring to chairs number 4 and 6 in this row and chairs with number 5 in rows 1 and 3. Thus, chairs have four neighbours in general, except for the chairs on the border of the hall

We know that if two parliamentarians from one political party (that is two Democrats or two Republicans) seat nearby they spent all time discussing internal party issues.

Write the program that given the number of parliamentarians and the sizes of the hall determine if there is a way to find a seat for any parliamentarian, such that no two members of the same party share neighbouring seats.


-----Input-----

The first line of the input contains three integers n, a and b (1 ≤ n ≤ 10 000, 1 ≤ a, b ≤ 100) — the number of parliamentarians, the number of rows in the assembly hall and the number of seats in each row, respectively.


-----Output-----

If there is no way to assigns seats to parliamentarians in a proper way print -1.

Otherwise print the solution in a lines, each containing b integers. The j-th integer of the i-th line should be equal to the index of parliamentarian occupying this seat, or 0 if this seat should remain empty. If there are multiple possible solution, you may print any of them.


-----Examples-----
Input
3 2 2

Output
0 3
1 2

Input
8 4 3

Output
7 8 3
0 1 4
6 0 5
0 2 0

Input
10 2 2

Output
-1



-----Note-----

In the first sample there are many other possible solutions. For example, 3 2

0 1



and 2 1

3 0



The following assignment 3 2

1 0



is incorrect, because parliamentarians 1 and 3 are both from Democrats party but will occupy neighbouring seats.

Difficulty: interview

Starter code:

Solutions:
# You lost the game.
n, a, b = map(int, input().split())
dem = n//2 + n%2
i = 1
while dem > 0 and i <= a:
    dem -= b//2 + (i%2)*(b%2)
    i += 1
if dem > 0:
    print(-1)
else:
    dem = n//2 + n%2
    demo = [2*k+1 for k in range(dem)]
    rep = [2*k for k in range(1,n//2+1)]
    d = 0
    r = 0
    l = 0
    for i in range(a):
        l = 1-l
        e = l
        for j in range(b):
            if e and d < dem:
                print(demo[d],end=" ")
                d += 1
            elif e == 0 and r < n//2:
                print(rep[r],end=" ")
                r += 1
            else:
                print(0,end=" ")
            e = 1-e
        print()
    
    

# @see http://codeforces.com/contest/644/problem/0

import sys


n, a, b = [int(x) for x in input().strip().split(' ')]

if n > a*b:
    print(-1)
else:
    for i in range(a):
        if b % 2 == 0 and i % 2 == 0:
            for j in reversed(range(b)):
                number = i*b + j + 1
                if number > n:
                    print(0, ' ', end="")
                else:
                    print(number, ' ', end="")
        else:
            for j in range(b):
                number = i*b + j + 1
                if number > n:
                    print(0, ' ', end="")
                else:
                    print(number, ' ', end="")
        print()


n, a, b = [int(x) for x in input().split()]
s = [ [0 for j in range(b)] for i in range(a) ]
x, y = 1, 2
i, j = 0, 0
last = 0
while i < a and (x <= n or y <= n):
    parity = True
    while j < b and (x <= n or y <= n):
        if parity and x<=n:
            s[i][j] = x  
            x += 2
        elif not parity: 
            s[i][j] = y
            y += 2
        parity = not parity
        last = max(last, s[i][j])
        j += 1
    i += 1
    j  = 0
    x, y = y, x
if last == n:
    print('\n'.join(' '.join(str(x) for x in ln) for ln in s))
else:
    print(-1)


n, a, b = map(int, input().split())

if n > a * b:
    print(-1)
else:
    for i in range(a):
        for j in range(b):
            val = i * b + 1
            val += (j if i % 2 == 0 else b - 1 - j)
            print(val if val <= n else 0, end = ' ')
        print()
        

[n,a,b] = list(map(int,input().split(' ')))

r = [(b+1)*[0] for _ in range(a+1)]
t = list(range(1, n+1))
for i in range(1,a+1):
    for j in range(1,b+1):
        for it in t:
            if (r[i-1][j] == 0 or r[i-1][j]%2 != it%2) and (r[i][j-1] == 0 or r[i][j-1]%2 != it%2):
                r[i][j] = it
                break
        if r[i][j] != 0:
            t.remove(r[i][j])
if len(t) == 0:
    for i in r[1:]:
        print(*i[1:])
else:
    print(-1)


s = input().split(' ')
n = int(s[0])
a = int(s[1])
b = int(s[2])

if(n > a * b):
    print(-1)
else:
    for i in range(a):
        s = ''
        for j in range(b):
                if(i % 2 == 0):
                    m = i * b + j + 1
                    if(m <= n):
                        s += str(m) + ' '
                    else:
                        s += '0 '
                else:
                    m = (i + 1) * b - j
                    if(m <= n):
                        s += str(m) + ' '
                    else:
                        s += '0 '
        print(s)

import sys

# sys.stdin = open("ivo.in")
n, a, b = list(map(int, sys.stdin.readline().split()))

if n > a * b:
  print(-1)
  return

res = []
for i in range(a):
  res.append([])
  for j in range(b):
    res[i].append(0)
for i in range(n):
  res[i // b][i % b] = i + 1

for j in range(1, a, 2):
  res[j].reverse()

for i in range(a):
  print(" ".join(map(str, res[i])))



def task(a, b, n):
    # check hall capacity
    if n > (a * b):
        print(-1)
        return

    guest_d = 1  # dem guest
    guest_r = 2  # rep guest

    for i in range(a):
        line = ""
        # check row index
        if i % 2 == 0:
            # democrats go first
            for j in range(b):
                # check seat index
                if j % 2 == 0:
                    if guest_d > n:
                        guest_d = 0  # no more democrats

                    if guest_d == 0:
                        line += "0 "
                        continue

                    line += str(guest_d) + " "
                    guest_d += 2

                else:
                    if guest_r > n:
                        guest_r = 0  # no more republicans

                    if guest_r == 0:
                        line += "0 "
                        continue

                    line += str(guest_r) + " "
                    guest_r += 2

        else:
            # republicans go first
            for j in range(b):
                # check seat index
                if j % 2 == 0:
                    if guest_r > n:
                        guest_r = 0  # no more republicans

                    if guest_r == 0:
                        line += "0 "
                        continue

                    line += str(guest_r) + " "
                    guest_r += 2

                else:
                    if guest_d > n:
                        guest_d = 0  # no more democrats

                    if guest_d == 0:
                        line += "0 "
                        continue

                    line += str(guest_d) + " "
                    guest_d += 2


        print(line)


def main():
    # read program args
    line = input().split(" ")
    n = int(line[0])
    a = int(line[1])
    b = int(line[2])

    # list of guests
    task(a, b, n)

main()


parliamentarian_quantity, hight, width = map(int, input().split())
if parliamentarian_quantity <= hight*width:
    assembly_hall = [[0]*width for row in range(hight)]
    current = 1
    parity = 1 if width%2 == 0 else 0
    occupied_chairs = 0
    for i in range(hight):
        for j in range(width):
            if occupied_chairs <= parliamentarian_quantity:
                parliamentarian_number = j + 1 + i*width + parity*(i%2)
                if parliamentarian_number <= parliamentarian_quantity:
                    assembly_hall[i][j] = parliamentarian_number
                    occupied_chairs += 1
                parity = -parity
            else:
                break
    [print(" ".join(map(str, row))) for row in assembly_hall]
else:
    print(-1)

n,a,b = map(int,input().split())
s = a*b

if s < n:
    print(-1)

else:
    if b%2 == 1:
        for i in range(a):
            for j in range(b):
                x = i*b +j + 1
                if x > n:
                    print(0, end=' ')
                else:
                    print(x, end=' ')
            print()
    else:
        for i in range(a):
            for j in range(b):
                x = i*b +j + 1
                if i%2 == 1:
                    x = i*b + b - j
                if x > n:
                    print(0, end=' ')
                else:
                    print(x, end=' ')
            print()        

n, a, b = [int(x) for x in input().split()]
arr = [[0] * b for i in range(a)]
cnt = 1
if n > a * b:
    print(-1)
else:
    flag = True
    for i in range(a):
        if flag:
            for j in range(b):
                if cnt <= n:
                    arr[i][j] = cnt
                    cnt += 1
            flag = False
        else:
            for j in range(b - 1, -1, -1):
                if cnt <= n:
                    arr[i][j] = cnt
                    cnt += 1
            flag = True
    for i in range(a):
        print(*arr[i])

N = [int(i) for i in input().split()]

n = N[0]
a = N[1]
b = N[2]

if n > a*b :
	print (-1)
else :
	dem = [int (i) for i in range (1,n+1,2)]
	resp = [int (i) for i in range (2,n+1,2)]
	i = 0
	res = []

	l_r = len(resp)
	i_r = 0

	l_d = len(dem)
	i_d = 0
	k = 0
	for i in range(a) :
		if k == 0 :
			k = 1
		else :
			k = 0
		res = []
		for j in range (b) :
			if k == 1 :
				if j % 2 == 0 :
					if i_d < l_d:
						res.append (dem[i_d])
						i_d += 1
					else :
						res.append (0)
				else :
					if i_r < l_r :
						res.append (resp[i_r])
						i_r += 1
					else :
						res.append (0)
			else :
				if j % 2 == 1 :
					if i_d < l_d:
						res.append (dem[i_d])
						i_d += 1
					else :
						res.append (0)
				else :
					if i_r < l_r :
						res.append (resp[i_r])
						i_r += 1
					else :
						res.append (0)
		print (*res)

n,a,b = (int(i) for i in input().split())
ans = [[0 for i in range(b)] for j in range(a)]
if n>a*b:
    print(-1)
else:
    k = 1
    for i in range(a):
        for j in range(b):
            if n == 0 :
                break
            else:
                ans[i][j] = k
                k+=1
                n-=1
    if b%2 == 1:
        for i in range(a):
            print(' '.join(list(map(str,ans[i]))))
    else:
        for i in range(a):
            if i%2 == 0:
                print(' '.join(list(map(str,ans[i]))))
            else:
                ans[i] = [ans[i][-1]]+ans[i][0:-1]
                print(' '.join(list(map(str,ans[i]))))
                
        
        
       


n, a, b = map(int, input().split())
if n > a * b:
    print(-1)
else:
    data = [[ i + 1 + b * j for i in range(b)][::pow(-1, j)] for j in range(a)]
    for i in range(a):
        for j in range(b):
            if data[i][j] > n:
                print(0, end=' ')
            else:
                print(data[i][j], end=' ')
        print()

n, a, b = map(int, input().split())
if a * b < n:
    print(-1)
    return

curr = 1
add = 1
res = []
for i in range(a):
    res.append([])
    for j in range(b):
        res[i].append(curr)
        curr += add
        if curr > n:
            curr = 0
            add = 0
for i in range(1, a, 2):
    res[i] = res[i][::-1]
for elem in res:
    print(' '.join(map(str, elem)))

n, a, b = (int(s) for s in input().split())
if a*b < n:
    print(-1)
elif b%2:
    for i in range(a):
        print(*[j if j<=n else 0 for j in range(i*b+1, (i+1)*b+1)])
else:
    for i in range(a):
        if i%2:
            print(*[j if j<=n else 0 for j in range(i*b+1, (i+1)*b+1)])
        else:
            print(*[j if j<=n else 0 for j in range(i*b+1, (i+1)*b+1)][::-1])


n, a, b = list(map(int, input().split()))
if a * b < n:
    print(-1)
else:
    chairs = list(map(str, list(range(1, n + 1)) + [0] * (a*b - n)))
    for i, (start, end) in enumerate(zip(list(range(0, a*b, b)), list(range(b, a*b + 1, b)))):
        if i % 2:
            print(' '.join(reversed(chairs[start:end])))
        else:
            print(' '.join(chairs[start:end]))


n,a,b=map(int,input().split())
l=[['0']*b for i in range(a)]
if n>a*b: print(-1)
else:
    for i in range(n):
        ii=i//b
        jj=i%b if ii%2==0 else b-i%b-1
        l[ii][jj]=str(i+1)
    print('\n'.join(map(' '.join,l)))

n,a,b=list(int(x) for x in input().split(' '))

def parlament(n,a,b):
    if n>a*b:
        print(-1)
        return 0
    if(n>=b):
        up=list(range(1,b+1))
        current=list(range(1,b+1))
    else:
        up=list(range(1,n+1))
        current=list(range(1,n+1))
        for x in range(b-n):
            current.append(0)
    print(*current)
    current=list()
    chet=b-(b%2)
    nechet=(b-1)+(b-chet)+2
    chet+=2


    for i in range(a-1):

        for j in range(b):


            if(nechet<=n and up[j]%2==0):

                print(nechet,end=' ')

                current.append(nechet)
                nechet=(nechet+2)
            elif(chet<=n and up[j]%2!=0):

                print(chet,end=' ')

                current.append(chet)
                chet=(chet+2)
            else:
                print(0, end=' ')
        up=list(current)
        current=list()




        print()



parlament(n,a,b)

#!/usr/bin/env python3

n, a, b = [int(x) for x in input().split()]

if n > a*b:
    print(-1)
else:
    for i in range(0, a):
        if i % 2 == 0:
            for j in range(b*i, b * (i + 1)):
                if j >= n:
                    print(0, end=' ')
                else:
                    print(j + 1, end=' ')
        else:
            for j in range(b * (i + 1) - 1, b*i - 1, -1):
                if j >= n:
                    print(0, end=' ')
                else:
                    print(j + 1, end=' ')
        print()


n, a, b = list(map(int, input().split()))
rev, akt = False, 0

if n > a * b:
    print(-1)
else:
    pole = [str(i + 1) for i in range(n)]

    for i in range(a):
        akt2 = akt + b
        if akt2 > n:
            akt2 = n

        odpoved = pole[akt:akt2]

        if len(odpoved) < b:
            odpoved += [str(0) for j in range(b - len(odpoved))]

        if rev:
            print(' '.join(reversed(odpoved)))
        else:
            print(' '.join(odpoved))

        rev = not rev
        akt += b


n, a, b = map(int, input().split())
if a * b < n:
    print(-1)
else:
    for i in range(a):
        if b % 2 == 1 or i % 2 == 0:
            for j in range(1, b + 1):
                k = b* i + j
                if k > n:
                    k = 0
                print(k, end = ' ')
            print(' ')
        else:
            for j in range(b, 0, -1):
                k = b* i + j
                if k > n:
                    k = 0
                print(k, end = ' ')
            print(' ')