n,d,k=[int(x) for x in raw_input().split()]
p=k**((d/2)+1)
p=p/(k-1)
if(d%2):
    p=p+k
if(p<n):
    print("NO")

else:    
    l=[]
    f=2
    i=0
    print("YES")
    l.append(1)
    while f<=n :
        
        j=l[i]
        c=0
        while(c<k and f<=n):
            print j,f
            l.append(f)
            f=f+1
            c=c+1
        i=i+1    
    
