T = input().split(' ')
n, d, k = int(T[0]), int(T[1]), int(T[2])
p = d // 2
if k != 1:
    s = ((k ** (p+1)) - 1) // (k - 1)
    if d % 2 == 1:
        s += (k ** p)
    if s < n:
        print("NO")
    else:
        print("YES")
        a = 1
        b = 2
        t = 0
        w = 0
        while t < n-1:
            if w < k:
                print(a, end=' ')
                print(b)
                b+=1
                w+=1
                t+=1
            else:
                w=0
                a+=1
else:
    if d+1 < n:
        print("NO")
    else:
        print("YES")
        for i in range(1, n):
            print(i, end=' ')
            print(i+1)
