import sys

input = sys.stdin.readline

def main():

	a = input().split(" ")
	n = int(a[0])
	d = int(a[1])
	k = int(a[2])

	maxdep = d // 2

	maxnodes = 1
	cp = [1]
	for i in range(1, maxdep + 1):
		cp.append(min(10**8, cp[-1] * k))
		maxnodes += cp[-1]

	if d % 2 == 1:
		maxnodes += cp[-1]
		cp.append(cp[-1])

	if maxnodes < n:
		sys.stdout.write("NO\n")
		return

	sys.stdout.write("YES\n")

	prevlevel = [1]
	currlevel = []
	cnode = 2
	for i in range(1, len(cp)):
		for j in range(cp[i]):
			par = prevlevel[j // k]
			currlevel.append(cnode)
			sys.stdout.write(str(cnode) + " " + str(par) + "\n")
			cnode += 1
			if cnode > n:
				break
		if cnode > n:
			break

		prevlevel = currlevel
		currlevel = []

main()