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: EASY
Tags: Constructive algorithms

Starter code:

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


def main():
	(n, a, b) = map(int, input().split())
	if n > a * b:
		print(-1)
		return
	res = [[0] * b for _ in range(a)]
	for i in range(n):
		(y, x) = divmod(i, b)
		res[y][b - x - 1 if y & 1 else x] = i + 1
	for row in res:
		print(' '.join(map(str, row)))
main()


(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)
	exit()
seats = list(range(1, n + 1)) + [0] * (a * b - n)
for i in range(a):
	row = seats[i * b:i * b + b]
	print(' '.join(map(str, row if b % 2 or i % 2 else row[::-1])))


def inp():
	lst = input().split()
	return [int(el) for el in lst]

def f(lst):
	(n, a, b) = lst
	if n > a * b:
		res = '-1'
	else:
		sit = []
		for i in range(a):
			temp_list = [i_n + 1 if i_n < n else 0 for i_n in range(i * b, (i + 1) * b)]
			if not (i % 2 == 0 or b % 2 == 1):
				temp_list.reverse()
			sit.append(temp_list)
		res = '\n'.join((' '.join((str(h) for h in s)) for s in sit))
	return res
print(f(inp()))


(n, a, b) = map(int, input().split())
if n > a * b:
	print(-1)
else:
	c = [[0 for j in range(b)] for i in range(a)]
	p = 1
	i = 0
	j = 0
	while p <= n:
		if i % 2 == 0:
			for j in range(b):
				if p > n:
					break
				c[i][j] = p
				p += 1
		else:
			for j in reversed(range(b)):
				if p > n:
					break
				c[i][j] = p
				p += 1
		i += 1
	for i in range(a):
		print(*c[i])


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) = map(int, input().split())
k = a * b - n
if k < 0:
	print(-1)
else:
	p = list(map(str, range(1, n + 1))) + ['0'] * k
	for i in range(a):
		t = p[i * b:i * b + b]
		print(' '.join(t if b & 1 or i & 1 else t[::-1]))


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


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


(n, a, b) = [int(s) for s in input().split()]
if n > a * b:
	print(-1)
else:
	m = [[0 for i in range(b)] for j in range(a)]
	(i, j) = (0, 0)
	dj = 1
	for cur in range(1, n + 1):
		m[i][j] = cur
		j = j + dj
		if j == -1:
			(i, j) = (i + 1, 0)
			dj = 1
		if j == b:
			(i, j) = (i + 1, b - 1)
			dj = -1
	for row in m:
		print(' '.join([str(elem) for elem in row]))


def main():
	(n, a, b) = (int(i) for i in input().split())
	if a * b < n:
		print('-1')
		return
	res = list(range(1, n + 1)) + [0] * (a * b - n)
	res = [res[i * b:b * (i + 1)] for i in range(0, (a * b + b - 1) // b)]
	if b % 2 == 0:
		res = [list(reversed(l)) if i % 2 == 1 else l for (i, l) in enumerate(res)]
	print('\n'.join((' '.join(map(str, l)) for l in res)))
main()


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


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


(n, a, b) = [int(x) for x in input().split()]
if a * b < n:
	print(-1)
else:
	odd = iter(range(1, n + 1, 2))
	even = iter(range(2, n + 1, 2))
	for i in range(a):
		for j in range(b):
			if (i + j) % 2 == 0:
				print(next(odd, 0), end=' ')
			else:
				print(next(even, 0), end=' ')
		print()


def mp():
	return map(int, input().split())

def lt():
	return list(map(int, input().split()))

def pt(x):
	print(x)

def ip():
	return input()

def it():
	return int(input())

def sl(x):
	return [t for t in x]

def spl(x):
	return x.split()

def aj(liste, item):
	liste.append(item)

def bin(x):
	return '{0:b}'.format(x)

def printlist(l):
	print(' '.join([str(x) for x in l]))

def listring(l):
	return ''.join([str(x) for x in l])
(n, a, b) = mp()
if n > a * b:
	print(-1)
	exit()
G = [[0 for j in range(b)] for i in range(a)]
if b % 2 == 0:
	for i in range(n):
		(r, s) = (i // b, i % b)
		if r % 2 == 0:
			G[r][s] = i + 1
		else:
			G[r][b - 1 - s] = i + 1
else:
	for i in range(n):
		(r, s) = (i // b, i % b)
		G[r][s] = i + 1
for i in range(a):
	printlist(G[i])


import sys

def main():
	(n, a, b) = [int(tok) for tok in sys.stdin.readline().split()]
	if n > a * b:
		print(-1)
		return
	n_even_ppl = n // 2
	n_odd_ppl = n - n_even_ppl
	z = [[0 for j in range(b)] for i in range(a)]
	even_rem = 0 if n_even_ppl > n_odd_ppl else 1
	odd_rem = 1 - even_rem
	for i in range(a):
		for j in range(b):
			if (i + j) % 2 == odd_rem and n_odd_ppl > 0:
				z[i][j] = 2 * n_odd_ppl - 1
				n_odd_ppl -= 1
			if (i + j) % 2 == even_rem and n_even_ppl > 0:
				z[i][j] = 2 * n_even_ppl
				n_even_ppl -= 1
			if n_even_ppl + n_odd_ppl == 0:
				break
	if n_even_ppl + n_odd_ppl == 0:
		for i in range(a):
			print(' '.join([str(zij) for zij in z[i]]))
	else:
		print(int(-1))
main()


(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)


def e(x, n):
	if x > n:
		return 0
	else:
		return x

class CodeforcesTask644ASolution:

	def __init__(self):
		self.result = ''
		self.n_a_b = []

	def read_input(self):
		self.n_a_b = [int(x) for x in input().split(' ')]

	def process_task(self):
		if self.n_a_b[0] > self.n_a_b[1] * self.n_a_b[2]:
			self.result = '-1'
		else:
			result = []
			for x in range(self.n_a_b[1]):
				row = []
				for y in range(self.n_a_b[2]):
					row.append(x * self.n_a_b[2] + y + 1)
				result.append(row)
			if not self.n_a_b[2] % 2:
				for x in range(self.n_a_b[1]):
					if x % 2:
						result[x] = result[x][::-1]
			printable = [' '.join([str(e(x, self.n_a_b[0])) for x in row]) for row in result]
			self.result = '\n'.join(printable)

	def get_result(self):
		return self.result
Solution = CodeforcesTask644ASolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


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


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


(n, a, b) = (int(z) for z in input().split())
if a * b < n:
	print(-1)
else:
	i = 1
	s = ''
	if b % 2 == 1:
		while i <= n:
			if i % b != 0:
				s += str(i) + ' '
			else:
				print(s + str(i))
				s = ''
			i += 1
		while i <= a * b:
			if i % b != 0:
				s += '0 '
			else:
				print(s + '0')
				s = ''
			i += 1
	else:
		i = 1
		r = 1
		s = ''
		while i <= n:
			if i % b != 0 and r == 1 or ((i - 1) % b != 0 and r == -1):
				s += str(i) + ' '
				i += r
			else:
				print(s + str(i))
				s = ''
				i += b
				r *= -1
		if i > n > i + r * b:
			while (i - 1) % b != 0:
				if i <= n:
					s += str(i) + ' '
				else:
					s += '0 '
				i -= 1
			print(s + str(i))
			s = ''
			i += b
		while i <= a * b:
			if i % b != 0:
				s += '0 '
			else:
				print(s + '0')
				s = ''
			i += 1


(n, a, b) = 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


import sys
(n, a, b) = map(int, input().split())
(i, j, c, f) = [1, 1, 1, True]
if n > a * b:
	print(-1)
	sys.exit()
if b % 2 != 0:
	f = False
while i <= a:
	j = 1
	while j <= b:
		if i % 2 == 0 and f:
			cc = c + b - j
			if cc <= n:
				print(str(cc) + ' ', end='')
			else:
				print('0 ', end='')
		elif c <= n:
			print(str(c) + ' ', end='')
			c = c + 1
		else:
			print('0 ', end='')
		j = j + 1
	if i % 2 == 0 and f:
		c = c + b
	i = i + 1
	print('')


import collections
import random
import sys
try:
	from tqdm import tqdm
except:

	def tqdm(iterable):
		return iterable
__taskname = ''
if __taskname:
	sys.stdin = open(__taskname + '.in')
	sys.stdout = open(__taskname + '.out', 'w')
(n, a, b) = map(int, input().split())
if a * b < n:
	print(-1)
	exit(0)
for i in range(a):
	if i & 1:
		print(*list(range(n, max(0, n - b), -1)) + [0] * max(0, b - n))
	else:
		print(*[0] * max(0, b - n) + list(range(max(0, n - b) + 1, n + 1)))
	n = max(n - b, 0)


(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)))


import sys
(n, a, b) = [int(x) for x in sys.stdin.readline().split()]
(i, j) = (0, 0)
ans = [[0 for _ in range(b)] for __ in range(a)]
cur = 1
inc = True
if n > a * b:
	print(-1)
	exit()
while cur != n + 1:
	ans[i][j] = cur
	cur += 1
	if inc:
		j += 1
		if j == b:
			j -= 1
			i += 1
			inc = False
	else:
		j -= 1
		if j == -1:
			j += 1
			i += 1
			inc = True
for i in range(a):
	for j in range(b):
		print(ans[i][j], end=' ')
	print()


(members, row, column) = [int(a) for a in input().split(' ')]
if members <= row * column:
	current_row = []
	current_members_in_current_row = 0
	flip = 1
	for row_number in range(row):
		while current_members_in_current_row != column:
			current_row.append(str(members))
			current_members_in_current_row += 1
			if members != 0:
				members -= 1
		print(' '.join(current_row[::flip]))
		current_row = []
		current_members_in_current_row = 0
		flip *= -1
else:
	print(-1)


(n, a, b) = map(int, input().split())
if n > a * b:
	print(-1)
else:
	s = []
	for i in range(n):
		s.append(i + 1)
	for i in range(a * b - n):
		s.append(0)
	p = 1
	for i in range(0, a * b + 1, b):
		print(*s[i:i + b][::p])
		p *= -1


(n, a, b) = [int(x) for x in input().split()]
p = list()
pos = a
for i in range(b):
	pos = a
	if i + 1 <= n:
		q = [i + 1]
	else:
		q = [0]
		pos = 0
	for j in range(1, a):
		if b % 2 == 0:
			if i % 2 == 0:
				if j % 2 == 0:
					flag = b - 1
				else:
					flag = b + 1
				if q[j - 1] + flag <= n and j < pos:
					q.append(q[j - 1] + flag)
				else:
					q.append(0)
					pos = j
			else:
				if j % 2 == 0:
					flag = b + 1
				else:
					flag = b - 1
				if q[j - 1] + flag <= n and j < pos:
					q.append(q[j - 1] + flag)
				else:
					q.append(0)
					pos = j
		elif q[j - 1] + b <= n and j < pos:
			q.append(q[j - 1] + b)
		else:
			q.append(0)
			pos = j
	p.append(q)
if n > a * b:
	print(-1)
else:
	for x in range(a):
		for y in range(b):
			print(p[y][x], end=' ')
		print(end='\n')


def main():
	x = input().split()
	amount = int(x[0])
	a = int(x[1])
	b = int(x[2])
	if a * b < amount:
		print('-1')
	else:
		odd = []
		even = []
		loppu = []
		for i in range(amount):
			if i % 2 == 0:
				odd.append(i + 1)
			else:
				even.append(i + 1)
		for i in range(a):
			y = []
			if len(loppu) == 0 or loppu[i - 1][0] % 2 == 0:
				for j in range(b):
					if len(y) == 0 or y[j - 1] % 2 == 0:
						if len(odd) != 0:
							y.append(odd[0])
							odd.pop(0)
						else:
							y.append(0)
					elif len(even) != 0:
						y.append(even[0])
						even.pop(0)
					else:
						y.append(0)
				loppu.append(y)
			else:
				for j in range(b):
					if len(y) == 0 or y[j - 1] % 2 != 0:
						if len(even) != 0:
							y.append(even[0])
							even.pop(0)
						else:
							y.append(0)
					elif len(odd) != 0:
						y.append(odd[0])
						odd.pop(0)
					else:
						y.append(0)
				loppu.append(y)
		for i in range(a):
			for j in range(b):
				print(loppu[i][j], end='')
				if j < b - 1:
					print(' ', end='')
				else:
					print('')
main()


import sys
(n, a, b) = map(int, input().split())
if n > a * b:
	print(-1)
	sys.exit(0)
par = []
for i in range(1, n + 1, b):
	s = ['0'] * b
	for j in range(b):
		if i + j <= n:
			s[j] = str(i + j)
	par.append(s)
while len(par) < a:
	par.append(['0'] * b)
for i in range(a):
	if i % 2 == 0:
		par[i].reverse()
		print(' '.join(par[i]))
	else:
		print(' '.join(par[i]))


from sys import exit
(n, a, b) = map(int, input().split())
odd1 = a * b % 2 == 1
odd2 = n % 2 == 1
if odd1 == odd2:
	if n > a * b:
		print(-1)
		exit()
elif n + 1 > a * b:
	print(-1)
	exit()
numb = [1, 2]
for i in range(a):
	for j in range(b):
		party = (i % 2 + j % 2 + odd1 + 1) % 2
		c = numb[party]
		if c > n:
			c = 0
		numb[party] += 2
		print(c, end=' ')
	print()


(n, a, b) = map(int, input().split())
if n > a * b:
	print(-1)
else:
	for i in range(a):
		c = list(range(i * b + 1, min((i + 1) * b, n) + 1))
		c += [0] * (b - len(c))
		if b % 2 == 0 and i % 2 == 1:
			c.reverse()
		print(' '.join(map(str, c)))


import sys
(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])))


(n, a, b) = map(int, input().split())
if n > a * b:
	print(-1)
else:
	for i in range(a):
		s = []
		for j in range(b):
			s.append(n)
			if n > 0:
				n -= 1
		if i & 1 == 1:
			s.reverse()
		print(' '.join((str(v) for v in s)))


from itertools import combinations, accumulate, groupby, count
from sys import stdout, stdin, setrecursionlimit
from io import BytesIO, IOBase
from collections import *
from random import *
from bisect import *
from string import *
from queue import *
from heapq import *
from math import *
from os import *
from re import *

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = read(self._fd, max(fstat(self._fd).st_size, 8192))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = read(self._fd, max(fstat(self._fd).st_size, 8192))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(stdin, stdout) = (IOWrapper(stdin), IOWrapper(stdout))

def fast():
	return stdin.readline().strip()

def zzz():
	return [int(i) for i in fast().split()]
(z, zz) = (fast, lambda : list(map(int, z().split())))
(szz, graph, mod, szzz) = (lambda : sorted(zz()), {}, 10 ** 9 + 7, lambda : sorted(zzz()))

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def output(answer, end='\n'):
	stdout.write(str(answer) + end)
dx = [-1, 1, 0, 0, 1, -1, 1, -1]
dy = [0, 0, 1, -1, 1, -1, -1, 1]
(n, a, b) = zzz()
lst = [[0 for i in range(b)] for i in range(a)]
lst[0][0] = 1
(cnt1, cnt2) = (3, 2)
for i in range(1, b):
	if lst[0][i - 1] % 2:
		lst[0][i] = cnt2
		cnt2 += 2
	else:
		lst[0][i] = cnt1
		cnt1 += 2
for i in range(1, a):
	for j in range(b):
		if lst[i - 1][j] % 2:
			lst[i][j] = cnt2
			cnt2 += 2
		else:
			lst[i][j] = cnt1
			cnt1 += 2
if max(cnt1, cnt2) - 2 < n:
	exit(print(-1))
for i in range(a):
	for j in range(b):
		if lst[i][j] > n:
			lst[i][j] = 0
for i in lst:
	print(*i)


(n, a, b) = map(int, input().split())
s = [[0 for i in range(b)] for j in range(a)]
c = 1
i = 0
j = 0
f = 1
if n > a * b:
	print(-1)
	exit(0)
while c <= n:
	s[i][j] = c
	if i == a - 1 and f == 1:
		f *= -1
		j += 1
	elif i == 0 and f == -1:
		f *= -1
		j += 1
	else:
		i += f
	c += 1
for i in s:
	for j in i:
		print(j, end=' ')
	print()


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


(n, a, b) = map(int, input().split())
ans = []
if n <= a * b:
	if b % 2 == 1:
		for i in range(1, a * b + 1):
			if i <= n:
				ans.append(i)
			else:
				ans.append(0)
			if len(ans) % b == 0:
				print(*ans)
				ans = []
	else:
		for i in range(1, a * b + 1):
			if i <= n:
				ans.append(i)
			else:
				ans.append(0)
			if len(ans) % b == 0 and i // b % 2 == 1:
				print(*ans)
				ans = []
			elif len(ans) % b == 0 and i // b % 2 == 0:
				print(*ans[::-1])
				ans = []
else:
	print(-1)


from functools import reduce
(n, a, b) = [int(x) for x in input().split(' ')]
grid = [[0 for c in range(b)] for r in range(a)]
if n > a * b:
	print('-1')
else:
	i = 1
	r = 0
	c = 0
	direction = 1
	while i <= n:
		grid[r][c] = i
		c += direction
		i += 1
		if c == b or c < 0:
			r += 1
			direction *= -1
			c += direction
	for r in range(a):
		st = reduce(lambda x, y: '{0} {1}'.format(x, y), grid[r])
		print(st)


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


def solve(n, a, b):
	if n > a * b:
		return False
	M = [[0 for j in range(b)] for i in range(a)]
	for x in range(n):
		(i, j) = divmod(x, b)
		M[i][b - 1 - j if i % 2 else j] = x + 1
	return M
(n, a, b) = [int(x) for x in input().split()]
M = solve(n, a, b)
if not M:
	print(-1)
else:
	for i in range(a):
		print(' '.join(map(str, M[i])))


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

def print_list(li):
	res = ''
	for i in li:
		res += str(i) + ' '
	print(res[:-1])

def solve():
	k = 1
	if n > a * b:
		print('-1')
		return
	else:
		for i in range(0, a):
			temp = []
			for j in range(0, b):
				if k <= n:
					temp.append(k)
					k += 1
				else:
					temp.append('0')
			if i % 2 == 0:
				temp = reversed(temp)
			print_list(temp)
solve()


(n, r, c) = map(int, input().split())
g = [[0 for _ in range(c)] for _ in range(r)]
miss = [i for i in range(1, n + 1)]
for i in range(r):
	for j in range(c):
		tmp = list()
		cant = True
		while cant and miss:
			cant = False
			first = miss.pop()
			if i > 0 and g[i - 1][j] != 0 and (g[i - 1][j] % 2 == first % 2):
				cant = True
			elif j > 0 and g[i][j - 1] != 0 and (g[i][j - 1] % 2 == first % 2):
				cant = True
			if not cant:
				g[i][j] = first
			else:
				tmp.append(first)
		for v in tmp:
			miss.append(v)
if not miss:
	for l in g:
		print(' '.join(map(str, l)))
else:
	print(-1)


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


def main():
	(n, a, b) = (int(x) for x in input().split())
	seatings = solver(n, a, b)
	if seatings == -1:
		print(-1)
	else:
		for i in range(a):
			for j in range(b):
				print(seatings[i][j], end=' ')
			print()

def solver(n, a, b):
	if n > a * b:
		return -1
	else:
		L = [[0] * b for i in range(a)]
		if b % 2 == 0:
			for i in range(n):
				if i // b % 2 == 0:
					L[i // b][i % b] = i + 1
				else:
					L[i // b][b - i % b - 1] = i + 1
		else:
			for i in range(n):
				L[i // b][i % b] = i + 1
		return L
main()


(n, a, b) = map(int, input().split())
if a * b < n:
	print(-1)
	exit()
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(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) = map(int, input().split())
if n > a * b:
	print(-1)
	exit()
dd = 1
cur = 1
for j in range(a):
	s = ' '.join([str(i) if i <= n else '0' for i in range(cur, cur + b)][::dd])
	print(s)
	cur += b
	dd *= 1 if b % 2 == 1 else -1


(n, a, b) = map(int, input().split())
if n > a * b:
	print('-1')
	exit(0)
mat = [[0 for i in range(b)] for i in range(a)]
(x, y) = (2, 1)
for j in range(a):
	if j % 2:
		for i in range(0, b, 2):
			if x > n:
				break
			mat[j][i] = x
			x += 2
		if x > n:
			break
	else:
		for i in range(1, b, 2):
			if x > n:
				break
			mat[j][i] = x
			x += 2
		if x > n:
			break
for j in range(a):
	if j % 2:
		for i in range(1, b, 2):
			if y > n:
				break
			mat[j][i] = y
			y += 2
		if y > n:
			break
	else:
		for i in range(0, b, 2):
			if y > n:
				break
			mat[j][i] = y
			y += 2
		if y > n:
			break
for i in range(a):
	for j in range(b):
		print(mat[i][j], end=' ')
	print()


def is_black(i, j):
	return i % 2 == j % 2

def main():
	(n, a, b) = map(int, input().split())
	if n > a * b:
		print(-1)
		return
	swap = b % 2 == 0
	next_odd = 1
	next_even = 2

	def print_val(val):
		if val > n:
			print(0, end=' ')
		else:
			print(val, end=' ')
	for i in range(a):
		for j in range(b):
			if is_black(i, j):
				print_val(next_odd)
				next_odd += 2
			else:
				print_val(next_even)
				next_even += 2
		print()
main()


from sys import maxsize as m
from itertools import product as P

class Solution:

	def bazinga(self, N, p):
		pass
(n, a, b) = map(int, input().split(' '))
D = [str(i) for i in range(1, n + 1, 2)]
R = [str(i) for i in range(2, n + 1, 2)]
M = [[0 for i in range(b)] for i in range(a)]
for p in P([i for i in range(a)], [i for i in range(b)]):
	(x, y) = (p[0], p[1])
	if (x + y) % 2 != 0:
		if R != []:
			M[x][y] = R.pop(-1)
		else:
			M[x][y] = '0'
	elif D != []:
		M[x][y] = D.pop(-1)
	else:
		M[x][y] = '0'
if (len(D) > 0 or len(R) > 0) and n != 1:
	print(-1)
else:
	for i in range(len(M)):
		print(' '.join(M[i]))


(n, a, b) = map(int, input().split())
if a * b < n:
	print(-1)
	exit()
for i in range(a):
	x = [str(j) if j <= n else '0' for j in range(i * b + 1, (i + 1) * b + 1)]
	if i & 1 == 0:
		x = list(reversed(x))
	print(' '.join(x))


A = input().split()
a = [[0] * int(A[2]) for i in range(int(A[1]))]
count = 1
if int(A[1]) * int(A[2]) < int(A[0]):
	print(-1)
else:
	for i in range(int(A[1])):
		if i % 2 == 0:
			for j in range(int(A[2]) - 1, -1, -1):
				a[i][j] = count
				count += 1
				if count > int(A[0]):
					break
		else:
			for j in range(int(A[2])):
				a[i][j] = count
				count += 1
				if count > int(A[0]):
					break
		if count > int(A[0]):
			break
	for row in a:
		print(' '.join([str(elem) for elem in row]))


(n, a, b) = map(int, input().split())
if n > a * b:
	print(-1)
	exit(0)
l = list(map(str, range(1, n + 1))) + ['0'] * (a * b - n)
for i in range(a):
	print(' '.join(l[(i + 1) * b - 1:i * b - 1:-1] if i & 1 else l[i * b:(i + 1) * b]))


import sys

def check(c, n):
	have = [0] * (n + 1)
	for i in range(len(c)):
		for j in range(len(c[i])):
			have[c[i][j]] = 1
	return sum(have[1:]) == n
(n, a, b) = map(int, input().split())
t = [[0] * b for i in range(a)]
for i in range(a):
	for j in range(b):
		t[i][j] = i + j & 1
cur = 1
c = [[0] * b for i in range(a)]
for i in range(a):
	for j in range(b):
		if cur > n:
			break
		if t[i][j]:
			c[i][j] = cur
			cur += 2
cur = 2
for i in range(a):
	for j in range(b):
		if cur > n:
			break
		if not t[i][j]:
			c[i][j] = cur
			cur += 2
if check(c, n):
	for i in c:
		print(*i)
	sys.exit(0)
for i in range(a):
	for j in range(b):
		t[i][j] ^= 1
cur = 1
c = [[0] * b for i in range(a)]
for i in range(a):
	for j in range(b):
		if cur > n:
			break
		if t[i][j]:
			c[i][j] = cur
			cur += 2
cur = 2
for i in range(a):
	for j in range(b):
		if cur > n:
			break
		if not t[i][j]:
			c[i][j] = cur
			cur += 2
if check(c, n):
	for i in c:
		print(*i)
	sys.exit(0)
print(-1)


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


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)
				elif i_r < l_r:
					res.append(resp[i_r])
					i_r += 1
				else:
					res.append(0)
			elif j % 2 == 1:
				if i_d < l_d:
					res.append(dem[i_d])
					i_d += 1
				else:
					res.append(0)
			elif i_r < l_r:
				res.append(resp[i_r])
				i_r += 1
			else:
				res.append(0)
		print(*res)


(z, n, m) = map(int, input().split())
k = [[0] * m for i in range(n)]
if z > n * m:
	print(-1)
else:
	u = 1
	for i in range(n):
		if u > z:
			break
		for j in range(m):
			k[i][j] = u
			u += 1
			if u > z:
				break
	for i in range(n):
		if i % 2 == 0:
			for j in range(m):
				print(k[i][j], end=' ')
			print()
		else:
			for j in range(m - 1, -1, -1):
				print(k[i][j], end=' ')
			print()


(n, a, b) = map(int, input().split())
if n > a * b:
	print(-1)
else:
	daf = [x + 1 for x in range(n)]
	zero = a * b - n
	daf = [0] * zero + daf
	for i in range(a):
		has = daf[b * i:b * (i + 1)]
		if i % 2 == 1:
			has = has[::-1]
		print(*has)


def main_function():
	(n, a, b) = [int(i) for i in input().split(' ')]
	if a * b < n:
		print(-1)
	else:
		var_1 = 1
		var_2 = 2
		bulchik = True
		seats = [[0 for i in range(b)] for j in range(a)]
		for row in range(len(seats)):
			for seat in range(len(seats[row])):
				if row % 2 == 0:
					if seat % 2 == 0:
						if var_1 <= n:
							seats[row][seat] = var_1
							var_1 += 2
					elif var_2 <= n:
						seats[row][seat] = var_2
						var_2 += 2
				elif seat % 2 == 0:
					if var_2 <= n:
						seats[row][seat] = var_2
						var_2 += 2
				elif var_1 <= n:
					seats[row][seat] = var_1
					var_1 += 2
		for i in seats:
			print(' '.join([str(k) for k in i]))
main_function()


(n, a, b) = map(int, input().split())
pole = [[1 for i in range(b + 2)] for j in range(a + 2)]
for i in range(1, a + 1):
	for j in range(1, b + 1):
		pole[i][j] = 0
now = 1
flag = False
i = 1
j = 1
if n <= a * b:
	while True:
		while pole[i][j] == 0:
			pole[i][j] = now
			now += 1
			if now == n + 1:
				flag = True
				break
			i += 1
		i -= 1
		j += 1
		if flag:
			break
		while pole[i][j] == 0:
			pole[i][j] = now
			now += 1
			if now == n + 1:
				flag = True
				break
			j += 1
		j -= 1
		i -= 1
		if flag:
			break
		while pole[i][j] == 0:
			pole[i][j] = now
			now += 1
			if now == n + 1:
				flag = True
				break
			i -= 1
		i += 1
		j -= 1
		if flag:
			break
		while pole[i][j] == 0:
			pole[i][j] = now
			now += 1
			if now == n + 1:
				flag = True
				break
			j -= 1
		if flag:
			break
		j += 1
		i += 1
	for i in range(1, len(pole) - 1):
		print(*pole[i][1:-1])
else:
	print(-1)


read = lambda : map(int, input().split())
(n, a, b) = read()
(cur1, cur2) = (1, 2)
p = [[0] * b for i in range(a)]
for i in range(a):
	for j in range(b):
		cur = i * b + j + 1
		if cur <= n:
			p[i][j] = cur
if b % 2 == 0:
	for i in range(1, a, 2):
		p[i] = p[i][1:] + [p[i][0]]
if a * b >= n:
	[print(*i) for i in p]
else:
	print(-1)


(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) = (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, string, column) = map(int, input().split())
seats = [[0 for i in range(column)] for j in range(string)]
memberss = []
membersf = []
for i in range(2, n + 1):
	if not i % 2:
		membersf.append(i)
	else:
		memberss.append(i)
for i in range(string):
	for j in range(column):
		if not i and (not j):
			seats[i][j] = 1
		elif not i:
			if seats[i][j - 1] % 2 and membersf:
				seats[i][j] = membersf.pop()
			elif not seats[i][j - 1] % 2 and memberss:
				seats[i][j] = memberss.pop()
		elif seats[i - 1][j] % 2 and membersf:
			seats[i][j] = membersf.pop()
		elif not seats[i - 1][j] % 2 and memberss:
			seats[i][j] = memberss.pop()
if not memberss and (not membersf):
	for i in range(string):
		for j in range(column):
			print(seats[i][j], end=' ')
		print('')
else:
	for i in range(1, n + 1):
		if i == 2:
			continue
		elif not i % 2:
			membersf.append(i)
		else:
			memberss.append(i)
	for i in range(string):
		for j in range(column):
			if not i and (not j):
				seats[i][j] = 2
			elif not i:
				if seats[i][j - 1] % 2 and membersf:
					seats[i][j] = membersf.pop()
				elif not seats[i][j - 1] % 2 and memberss:
					seats[i][j] = memberss.pop()
			elif seats[i - 1][j] % 2 and membersf:
				seats[i][j] = membersf.pop()
			elif not seats[i - 1][j] % 2 and memberss:
				seats[i][j] = memberss.pop()
	if not memberss and (not memersf):
		for i in range(string):
			for j in range(column):
				print(seats[i][j], end=' ')
			print('')
	else:
		print('-1')


(n, a, b) = map(int, input().split())
if a * b < n:
	print(-1)
else:
	i = 1
	for k in range(a):
		l = []
		j = 0
		if k % 2 == 0:
			while i <= a * b and j < b:
				if i <= n:
					l.append(i)
				else:
					l.append(0)
				i += 1
				j += 1
		else:
			while i <= a * b and j < b:
				if i <= n:
					l.insert(0, i)
				else:
					l.insert(0, 0)
				i += 1
				j += 1
		print(*l)


in_values = list(map(int, input().split()))
nr_of_parliaments = in_values[0]
rows = in_values[1]
chairs = in_values[2]
if chairs * rows < nr_of_parliaments:
	print('-1')
else:
	p = 0
	for i in range(rows):
		out_row = []
		for j in range(chairs):
			p += 1
			if p <= nr_of_parliaments:
				out_row.append(p)
			else:
				out_row.append(0)
		if chairs % 2 == 0 and i % 2 == 0:
			out_row = out_row[::-1]
		print(*out_row)


(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)


def task(a, b, n):
	if n > a * b:
		print(-1)
		return
	guest_d = 1
	guest_r = 2
	for i in range(a):
		line = ''
		if i % 2 == 0:
			for j in range(b):
				if j % 2 == 0:
					if guest_d > n:
						guest_d = 0
					if guest_d == 0:
						line += '0 '
						continue
					line += str(guest_d) + ' '
					guest_d += 2
				else:
					if guest_r > n:
						guest_r = 0
					if guest_r == 0:
						line += '0 '
						continue
					line += str(guest_r) + ' '
					guest_r += 2
		else:
			for j in range(b):
				if j % 2 == 0:
					if guest_r > n:
						guest_r = 0
					if guest_r == 0:
						line += '0 '
						continue
					line += str(guest_r) + ' '
					guest_r += 2
				else:
					if guest_d > n:
						guest_d = 0
					if guest_d == 0:
						line += '0 '
						continue
					line += str(guest_d) + ' '
					guest_d += 2
		print(line)

def main():
	line = input().split(' ')
	n = int(line[0])
	a = int(line[1])
	b = int(line[2])
	task(a, b, n)
main()


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


import collections, itertools, functools, math

def solve():
	(n, a, b) = map(int, input().split())
	grid = [[0] * b for _ in range(a)]
	dem = 1
	rep = 2
	for i in range(a):
		for j in range(b):
			if (i + j) % 2 == 0:
				if dem <= n:
					grid[i][j] = dem
					dem += 2
			elif rep <= n:
				grid[i][j] = rep
				rep += 2
	if dem <= n or rep <= n:
		print(-1)
	else:
		for row in grid:
			print(*row)
solve()


[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)


import itertools

def grouper(n, iterable):
	it = iter(iterable)
	while True:
		chunk = tuple(itertools.islice(it, n))
		if not chunk:
			return
		yield chunk
(n, a, b) = [int(x) for x in input().split()]
possible = True
t = []
if n > a * b:
	possible = False
	result = -1
	print(result)
if possible:
	for x in range(1, a + 1):
		t.append([])
		for i in range(1, b + 1):
			s = (x - 1) * b + i
			if x > 1:
				if s % 2 != 0 and t[x - 2][i - 1] % 2 != 0:
					s += 1
				elif s % 2 == 0 and t[x - 2][i - 1] % 2 == 0:
					s -= 1
			if s > n:
				s = 0
			t[x - 1].append(s)
	v = []
	for d in range(0, a):
		v += t[d]
	for chunk in grouper(b, v):
		print(' '.join((str(u) for u in chunk)))


(n, a, b) = map(int, input().split())
from sys import exit
for k in range(2):
	(A, even, odd) = ([], 2, 1)
	if k == 1:
		(even, odd) = (1, 2)
	for i in range(a):
		r = []
		for j in range(b):
			if (i + j) % 2 == 0:
				if even > n:
					r += [0]
					continue
				r += [even]
				even += 2
			else:
				if odd > n:
					r += [0]
					continue
				r += [odd]
				odd += 2
		A += [r]
	if even > n and odd > n:
		for r in A:
			print(*r, sep=' ')
		exit(0)
else:
	print(-1)


def set(counter, n, s):
	if counter <= n:
		s += str(counter) + ' '
		counter += 2
	else:
		s += '0 '
	return (counter, s)
s = input().split()
(n, a, b) = (int(s[0]), int(s[1]), int(s[2]))
(dc, rc) = (1, 2)
d = n / 2 + n % 2
if n > a * b:
	print('-1')
else:
	for i in range(a):
		s = ''
		for j in range(b):
			if i % 2 == j % 2:
				(dc, s) = set(dc, n, s)
			else:
				(rc, s) = set(rc, n, s)
		print(s)


(n, a, b) = 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(range(0, a * b, b), range(b, a * b + 1, b))):
		if i % 2:
			print(' '.join(reversed(chairs[start:end])))
		else:
			print(' '.join(chairs[start:end]))


(a, b, c) = map(int, input().split(' '))
if b * c < a:
	print(-1)
	quit()
k = []
for i in range(b):
	l = []
	for j in range(c):
		if i * c + j + 1 <= a:
			l.append(str(i * c + j + 1))
		else:
			l.append('0')
	if c % 2 == 0 and i % 2 == 0:
		l.reverse()
	print(' '.join(l))


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


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

def che():
	global n, a, b, arr
	arr = list(([0] * b for i in range(a)))
	k = 1
	for x in range(a):
		if x % 2 == 0:
			y0 = -1
			q = 1
		else:
			y0 = b
			q = -1
		for y in range(b):
			if k <= n:
				y0 += q
				arr[x][y0] = k
				k += 1

def neche():
	global n, a, b, arr
	arr = list(([0] * b for i in range(a)))
	k = 1
	for x in range(a):
		for y in range(b):
			if k <= n:
				arr[x][y] = k
				k += 1

def pri():
	global arr, a, b
	for x in range(a):
		for y in range(b):
			print(arr[x][y], end=' ')
		print()
if n > a * b:
	print(-1)
elif b % 2 == 0:
	che()
	pri()
else:
	neche()
	pri()


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


def read_ints():
	return list(map(int, input().split()))
(n, a, b) = read_ints()
if n > a * b:
	print(-1)
	exit()
odd = 1
even = 2
for i in range(0, a):
	for j in range(0, b):
		if (i + j) % 2 != 0:
			if even <= n:
				print(even, end=' ')
				even += 2
			else:
				print(0, end=' ')
		elif odd <= n:
			print(odd, end=' ')
			odd += 2
		else:
			print(0, end=' ')
	print()


(n, y, x) = list(map(int, input().split()))
(a, b) = [0, 0]
direct = 1
field = [[0 for j in range(x)] for i in range(y)]
if x * y >= n:
	for i in range(1, n + 1):
		field[b][a] = i
		if direct == 1:
			if a + direct < x and field[b][a + direct] == 0:
				a += direct
			elif b + direct < y and field[b + direct][a] == 0:
				b += direct
			else:
				direct = -1
				a += direct
		elif a + direct >= 0 and field[b][a + direct] == 0:
			a += direct
		elif b + direct >= 0 and field[b + direct][a] == 0:
			b += direct
		else:
			direct = 1
			a += direct
	for i in range(y):
		print(*field[i])
else:
	print(-1)


(n, a, b) = map(int, input().split())
ans = [[0 for i in range(b)] for j in range(a)]
x = 0
y = 0
for i in range(1, n + 1, 2):
	if 0 <= x < a and 0 <= y < b:
		ans[x][y] = i
	else:
		print(-1)
		exit(0)
	y += 2
	while y >= b:
		x += 1
		y = x % 2
x = 0
y = 1
while y >= b:
	x += 1
	y = (1 + x) % 2
for i in range(2, n + 1, 2):
	if 0 <= x < a and 0 <= y < b:
		ans[x][y] = i
	else:
		print(-1)
		exit(0)
	y += 2
	while y >= b:
		x += 1
		y = (1 + x) % 2
for i in range(a):
	print(' '.join(map(str, ans[i])))


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


(n, a, b) = map(int, input().split())
if a * b < n:
	print(-1)
else:
	x = 1
	for i in range(a):
		a = (*map(lambda x: [x, 0][x > n], range(x, x + b)),)
		if b % 2 < 1 and i % 2:
			a = a[::-1]
		print(*a)
		x += b


import sys
from collections import deque
(n, a, b) = map(int, input('').split())
seats = deque()
goodlist = []
if n > a * b:
	print(-1)
	sys.exit()
k = 0
i = 0
c = 1
if b % 2 != 0:
	for i in range(n):
		seats.append(i + 1)
		goodlist.append(i + 1)
	while len(seats) < a * b:
		seats.append(0)
		goodlist.append(0)
	while k <= len(seats) - b:
		p = k
		for item in goodlist[k:k + b]:
			if p == k + b - 1:
				print(item)
				continue
			print(item, end=' ')
			p = p + 1
		k = k + b
else:
	for i in range(n):
		seats.append(i + 1)
		goodlist.append(i + 1)
	while len(seats) < a * b:
		seats.append(0)
		goodlist.append(0)
	while k <= len(seats) - b:
		w = k
		if c % 2 == 0:
			for items in list(reversed(goodlist[k:k + b])):
				if w == k + b - 1:
					print(items)
				else:
					print(items, end=' ')
				w = w + 1
		else:
			for items in goodlist[k:k + b]:
				if w == k + b - 1:
					print(items)
				else:
					print(items, end=' ')
				w = w + 1
		c = c + 1
		k = k + b


(n, a, b) = map(lambda x: int(x), input().split())
result = [[0 for _ in range(b)] for _1 in range(a)]
number = 1
for row in range(a):
	for col in range(b):
		if number <= n:
			result[row][col if b % 2 or row % 2 == 0 else b - col - 1] = number
			number += 1
if number == n + 1:
	print('\n'.join(map(lambda x: ' '.join(map(lambda y: str(y), x)), result)))
else:
	print('-1')


import sys
EPS = sys.float_info.epsilon
LENGTH = 10
matrix = [[] for i in range(LENGTH)]
arr = [0] * 1001
(n, a, b) = map(int, input().split())
arr = [[0] * b for i in range(a)]
c1 = 3
c2 = 2
arr[0][0] = 1
for j in range(1, b):
	if j % 2 == 0 and c1 <= n:
		arr[0][j] = c1
		c1 += 2
	elif j % 2 == 1 and c2 <= n:
		arr[0][j] = c2
		c2 += 2
for i in range(1, a):
	for j in range(b):
		val = arr[i - 1][j]
		if val % 2 == 0 and c1 <= n:
			arr[i][j] = c1
			c1 += 2
		elif val % 2 == 1 and c2 <= n:
			arr[i][j] = c2
			c2 += 2
if c1 > n and c2 > n:
	for i in range(a):
		for j in range(b):
			print(arr[i][j], end=' ')
		print()
else:
	arr = [[0] * b for i in range(a)]
	c1 = 1
	c2 = 4
	arr[0][0] = 2
	for j in range(1, b):
		if j % 2 == 1 and c1 <= n:
			arr[0][j] = c1
			c1 += 2
		elif j % 2 == 0 and c2 <= n:
			arr[0][j] = c2
			c2 += 2
	for i in range(1, a):
		for j in range(b):
			val = arr[i - 1][j]
			if val % 2 == 0 and c1 <= n:
				arr[i][j] = c1
				c1 += 2
			elif val % 2 == 1 and c2 <= n:
				arr[i][j] = c2
				c2 += 2
	if c1 > n and c2 > n:
		for i in range(a):
			for j in range(b):
				print(arr[i][j], end=' ')
			print()
	else:
		print(-1)


(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, 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()


(n, b, a) = map(int, input().split())
mem = list((x for x in range(n)))
if len(mem) > a * b:
	print('-1')
else:
	tmp_list = list((0 for _ in range(a * b)))
	for i in range(len(mem)):
		tmp_list[i] = mem[i] + 1
	index = 0
	output = ''
	for row in range(b):
		if a % 2 == 0 and (row + 1) % 2 == 0:
			tmp = tmp_list[index:index + a]
			tmp = tmp[::-1]
			output += ' '.join((str(x) for x in tmp))
			index += a
		else:
			tmp = tmp_list[index:index + a]
			output += ' '.join((str(x) for x in tmp))
			index += a
		output += '\n'
	print(output)


from _operator import le
head = list(map(int, input().split()))
n = head[0]
a = head[1]
b = head[2]
if a * b >= n:
	arr = matrix = [[int(0)] * b for i in range(a)]
	flag = 0
	x = 1
	for i in range(0, a):
		for j in range(flag, b, 2):
			if x > n:
				flag = -1
				break
			arr[i][j] = x
			x += 2
		if flag == -1:
			break
		flag = 1 if flag == 0 else 0
	flag = 1
	x = 2
	for i in range(0, a):
		for j in range(flag, b, 2):
			if x > n:
				flag = -1
				break
			arr[i][j] = x
			x += 2
		if flag == -1:
			break
		flag = 1 if flag == 0 else 0
	for i in range(0, a):
		for j in range(0, b):
			print(arr[i][j], end=' ')
		print()
else:
	print(-1)


(n, a, b) = [int(x) for x in input().split()]
if n > a * b:
	print(-1)
	quit()
for i in range(a):
	if i % 2 == 0:
		for j in range(b):
			if n > 0:
				print(n, end=' ')
				n -= 1
			else:
				print(0, end=' ')
	else:
		mas = []
		for j in range(b):
			if n > 0:
				mas.append(n)
				n -= 1
			else:
				mas.append(n)
		for k in mas[::-1]:
			print(k, end=' ')
	print()


(n, a, b) = map(int, input().split())
c = []
if a * b < n:
	print(-1)
else:
	for x in range(1, n + 1):
		c.append(str(x))
	for x in range(a * b - n):
		c.append('0')
	for x in range(1, a + 1):
		e = ''
		if x % 2 != 0:
			for x in range(b):
				if x != b - 1:
					e += c[0] + ' '
				else:
					e += c[0]
				c.pop(0)
			e.strip()
			print(e)
		else:
			for x in range(b, 0, -1):
				if x != 1:
					e += c[x - 1] + ' '
				else:
					e += c[x - 1]
				c.pop(x - 1)
			e.strip()
			print(e)


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


import sys, math
readline = sys.stdin.readline
(n, a, b) = map(int, readline().split())
if a * b < n:
	print(-1)
else:
	tmp = []
	for i in range(a):
		for j in range(b):
			t = 1 + b * i + j
			if t > n:
				t = 0
			tmp.append(t)
	if b % 2 == 0:
		for i in range(1, a, 2):
			for j in range(0, b, 2):
				t = b * i + j
				(tmp[t], tmp[t + 1]) = (tmp[t + 1], tmp[t])
	for i in range(a * b):
		print(tmp[i], end=' ')
		if i != 0 and n % i == 0:
			print()


st = list(map(int, input().split()))
n = st[0]
a = st[1]
b = st[2]
k = 1
data = [[0] * b for i in range(a)]
if n <= a * b:
	for i in range(a):
		for j in range(b):
			if k <= n:
				data[i][j] = k
				k += 1
	if b % 2 == 0:
		for i in range(1, a, 2):
			data[i] = reversed(data[i])
	for i in range(a):
		print(*data[i])
else:
	print(-1)


(n, a, b) = map(int, input().split())
summ = a * b
k = n // 2
l = n - n // 2
x = summ // 2
y = summ - summ // 2
if k > l:
	(k, l) = (l, k)
if x > y:
	(x, y) = (y, x)
if x >= k and y >= l:
	ans = [[0] * b for i in range(a)]
	for i in range(a):
		for j in range(b):
			ans[i][j] = max(n, 0)
			n -= 1
	for i in range(a):
		if i % 2 == 0:
			print(*ans[i])
		else:
			print(*ans[i][::-1])
else:
	print(-1)


s = input()
(n, a, b) = s.split(' ')
n = int(n)
a = int(a)
b = int(b)
if n > a * b:
	print(-1)
else:
	for i in range(0, a * b):
		nRow = i // b
		if nRow % 2 == 0:
			x = i
		else:
			x = nRow * b + b - i % b - 1
		x = x + 1
		if x > n:
			x = '0'
		print(x, ' ', end='')
		if (i + 1) % b == 0:
			print()


(n, a, b) = map(int, input().split())
cnt = 0
d = []
for i in range(a):
	if a * b % 2 == 0 and i % 2 != 0:
		s = [i for i in range(cnt + 1, cnt + b + 1)][::-1]
		cnt = s[0]
	else:
		s = [i for i in range(cnt + 1, cnt + b + 1)]
		cnt = s[-1]
	d.append(s)
for i in d:
	for j in range(b):
		if i[j] > n:
			i[j] = 0
if n > a * b:
	print(-1)
else:
	for i in d:
		print(*i)


(n, a, b) = map(int, input().split())
answer = [[0] * b for i in range(a)]
flag1 = True
flag2 = True
cur_nech = 1
cur_chet = 2
if cur_chet > n:
	flag2 = False
if a * b < n:
	print(-1)
else:
	for i in range(a):
		for j in range(b):
			if (i + j) % 2 == 0 and flag1:
				answer[i][j] = cur_nech
				cur_nech += 2
				if cur_nech >= n + 1:
					flag1 = False
			if (i + j) % 2 == 1 and flag2:
				answer[i][j] = cur_chet
				cur_chet += 2
				if cur_chet >= n + 1:
					flag2 = False
	for i in range(a):
		print(*answer[i])


import sys

def get_single_int():
	return int(sys.stdin.readline().strip())

def get_string():
	return sys.stdin.readline().strip()

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))
(n, a, b) = get_ints()
if a * b < n:
	print(-1)
else:
	ans = []
	for i in range(b):
		tmp = []
		for j in range(a):
			calculation = i * a + j + 1
			if calculation > n:
				tmp.append(0)
			else:
				tmp.append(calculation)
		if i % 2 == 0:
			ans.append(tmp)
		else:
			ans.append(list(reversed(tmp)))
	for k in range(a):
		for m in range(b):
			if m == b - 1:
				print(ans[m][k], end='\n')
			else:
				print(ans[m][k], end=' ')


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


(n, a, b) = map(int, input().split())
if a * b < n:
	print(-1)
	exit(0)
q = [[0] * 102 for i in range(102)]
i = 0
j = 0
k = n - 1
while n > 0:
	q[i][j] = n
	n -= 1
	if j == b - 1 and i % 2 == 0:
		i += 1
	elif j == 0 and i % 2 == 1:
		i += 1
	elif i % 2 == 0:
		j += 1
	else:
		j -= 1
for i in range(a):
	for j in range(b):
		print(q[i][j], end=' ')
	print()


(n, a, b) = map(int, input().split())
ans = [[0] * b for _ in range(a)]
if n > a * b:
	print(-1)
else:
	for i in range(n):
		ans[i // b][i % b] = i + 1
	for i in range(a):
		if b % 2 == 0 and i % 2 == 1:
			ans[i] = ans[i][1:] + [ans[i][0]]
		print(*ans[i])


(n, a, b) = map(int, input().split())
if n > a * b:
	print(-1)
else:
	ch = 2
	ne = 1
	for y in range(a):
		for x in range(b):
			if (x + y) % 2:
				val = ch if ch <= n else 0
				ch += 2
			else:
				val = ne if ne <= n else 0
				ne += 2
			print(val, end=' ')
		print()