from collections import *
import sys
input=sys.stdin.readline
n,d,k=map(int,input().split())
deg={i:0 for i in range(1,n+1)}
flag=0
flag1=0
ans=[]
skew=[]
skew=deque(skew)
for i in range(d-1):
    deg[d-i]+=1
    deg[d-i-1]+=1
    ans.append([d-i,d-i-1])
    if(d-i!=d):
        skew.append(d-i)
skew.append(1)
deg[1]=1
pp=d+1
while(1):
    if(len(skew)==0):
        break
    p=skew.pop()
    while(deg[p]<k):
        if(pp==n+1):
            flag1=1
            break
        ans.append([p,pp])
        skew.appendleft(pp)
        deg[p]+=1
        deg[pp]+=1
        pp+=1
    if(flag1==1):
        break
if(pp!=n+1 or max(deg.values())>k or (k*(k-1)*(d-2))+(1+k)<n):
    print("NO")
else:
    print("YES")
    for i in ans:
        print(*i)
