import sys
n,d,k = map(int,raw_input().split())
if d >= n:
  print "NO"
  sys.exit()
edges = n-1
paths = [[] for x in range(n)]
ans = [[] for x in range(n)]
cnt = [0 for x in range(n)]
ind = 1

queue = [d/2]
if d%2:
  queue.append(d/2+1)
l = d/2-1
r = d/2+1

for i in range(d):
  paths[i].append(i+1)
  paths[i+1].append(i)
  ans[i].append(i+1)
  cnt[i] += 1
  cnt[i+1] += 1
  edges -= 1
  ind += 1

while queue:
  for _ in range(len(queue)):
    c = queue.pop(0)
    for i in range(ind,ind+k-cnt[c]):
      if not edges:
        break
      edges -= 1
      paths[i].append(c)
      paths[c].append(i)
      ans[c].append(i)
      queue.append(i)
      ind += 1
  if l>=0:
    queue.append(l)
    l -= 1
  if r <= d:
    queue.append(r)
    r += 1

queue = [n-1]
checked = [0 for x in range(n)]
checked[n-1] = 1
while queue:
  c = queue.pop(0)
  for i in paths[c]:
    if not checked[i]:
      checked[i] = checked[c]+1
      queue.append(i)
queue = [checked.index(max(checked))]
checked = [0 for x in range(n)]
checked[queue[0]] = 1
while queue:
  c = queue.pop(0)
  for i in paths[c]:
    if not checked[i]:
      checked[i] = checked[c]+1
      queue.append(i)
if max(checked)-1==d:
  print "YES"
  for i in range(n):
    for j in ans[i]:
      print i+1,j+1
else:
  print "NO"