#!/usr/bin/env python3
"""
Created on Wed Feb 28 11:47:12 2018

@author: mikolajbinkowski
"""
import sys

N, D, K = tuple([int(k) for k in input().split(' ')])

def search_free_vertex(t, v):
    while v < len(t):
        no_kids = len(t[v]['children'])
        if (no_kids < K-1) or ((no_kids < K) and (v == 0)):
            if (t[v]['depth'] < D//2) or (no_kids > 0):
                return v
        v += 1
    return None

def get_tree(n):
    #print('n, d',n, D)
    if n < D + 1:
        return None, None
    if K == 1:
        if (D == 1) and (n == 2):
            return [{'depth': 0, 'children': [1]}, {'depth':1, 'children':[]}], None
        return None, None
    if n == D + 1:
        if n == 2:
            return [{'depth': 0, 'children': [1]}, {'depth':1, 'children':[]}], 0
        else: 
            return [{'depth': 0, 'children': [1, 2]}] + [{'depth': (i+1)//2, 'children': [i+2]} for i in range(1, n-2)] + [{'depth': (n-1)//2, 'children':[]}, {'depth': n//2, 'children': []}], int(K == 2)
    n0 = D + 1
    t, v = get_tree(n0)
    while n0 < n:
        #print('t, v', t, v)
        if (t is None) or (v is None):
            return None, None
        v = search_free_vertex(t, v)
        if v is None:
            return None, None
        t[v]['children'].append(n0)
        t.append({'depth': t[v]['depth'] + 1, 'children': []})
        n0 += 1
    return t, v


T, _ = get_tree(N)
if T is None:
    print('NO')
else:
    print('YES')
    for i, v in enumerate(T):
        for j in v['children']:
            print('%d %d' % (i+1, j+1))

        
    
