n, d, k = map(int, input().split())
output = []
queue = []
n -= 1
for i in range(min(k, n)):
    output.append('{0} {1}'.format(1, i+2))
    queue.append((i+2, 1))
nxt = min(k, n)+2
n -= min(k, n)
prevdpt = 0
more = False
dpt = 0
while n > 0:
    x, dpt = queue.pop(0)
    if prevdpt == dpt:
        more = True
    prevdpt = dpt
    for i in range(min(k-1, n)):
        output.append('{0} {1}'.format(x, nxt))
        queue.append((nxt, dpt+1))
        nxt += 1
        n -= 1
dpt += 1
dpt *= 2
if not more:
    dpt -= 1
if dpt <= d:
    print('YES')
    for o in output:
        print(o)
else:
    print('NO')