Problem: Recently Pashmak has been employed in a transportation company. The company has k buses and has a contract with a school which has n students. The school planned to take the students to d different places for d days (each day in one place). Each day the company provides all the buses for the trip. Pashmak has to arrange the students in the buses. He wants to arrange the students in a way that no two students become close friends. In his ridiculous idea, two students will become close friends if and only if they are in the same buses for all d days.

Please help Pashmak with his weird idea. Assume that each bus has an unlimited capacity.

Input

The first line of input contains three space-separated integers n, k, d (1 ≤ n, d ≤ 1000; 1 ≤ k ≤ 109).

Output

If there is no valid arrangement just print -1. Otherwise print d lines, in each of them print n integers. The j-th integer of the i-th line shows which bus the j-th student has to take on the i-th day. You can assume that the buses are numbered from 1 to k.

Examples

Input

3 2 2


Output

1 1 2 
1 2 1 


Input

3 2 1


Output

-1

Note

Note that two students become close friends only if they share a bus each day. But the bus they share can differ from day to day.

Solution (in PYTHON3):

Solution:
#http://codeforces.com/problemset/problem/459/C

# Input of the values
n, k, d = map(int, input().split())

#Convention : 	Busses are numbered from 1 to k
#				Students are numbered from 0 to k - 1
# 				Days are numbered from 0 to k - 1

# Variable for success
success = True

# answer is a  2-d array that stores the bus number each student used on a particular day
# Students are numbered from 0 to n-1
answer = [[] for x in range(n)]

# Initialising the first students details manually
# The first student uses the bus 1 for all of the days
answer[0] = [1 for x in range(d)]

# we will be filling the details for each and every student and 
# would print -1 only if we cannot allot any bus number to the next student
for i_th_student in range(1,n):
	
	#answer for previous value
	i_minus_one_student = answer[i_th_student - 1]

	# Answer to the current student
	current_student = list(i_minus_one_student)

	# Days are also numbered from 0 to d-1
	for i_th_day in reversed(range(d)):

		# the condition to change the bus number 
		if i_minus_one_student[i_th_day] < k :

			current_student[i_th_day] += 1

			# all the numbers next to it are reset
			for i in range(i_th_day + 1, d):
				current_student[i] = 1
			
			break
	
	#Save the value
	answer[i_th_student] = current_student
	
	#Failed
	if current_student == i_minus_one_student:
		success = False
		break

# printing the output
if not(success):
	print ("-1")

else:
	# ans_trans is used for giving the output fast
	answer_trans= [[] for i in range(d)]
	for y in range(n):
		i = 0
		for x in answer[y]:
			answer_trans[i].append(x)
			i += 1
	for bla in answer_trans:
		print (' '.join(map(str, bla)))