#include <bits/stdc++.h>
using namespace std;
const int MAXN = 4E5 + 5;
int n, d, k, cur = -1;
int minD, maxD;
int Q[MAXN], Dep[MAXN], Anc[MAXN], Head[MAXN], Degree[MAXN], Stack[MAXN],
    Vis[MAXN];
long long typedef LL;
struct wyy {
  int to, next;
} Edge[2 * MAXN];
bool Check() {
  LL c = 0, num = 0, last = 0;
  while (1) {
    if (c == 0)
      num = 1, last = 1;
    else if (c == 1)
      num += k, last = k;
    else
      num += last * (k - 1), last = last * (k - 1);
    c++;
    if (num >= n) {
      if (num == n)
        minD = 2 * (c - 1);
      else
        minD = 2 * (c - 1) - 1;
      break;
    }
  }
  if (d < minD || d > n - 1) return false;
  return true;
}
void Add(int from, int to) {
  Edge[++cur].to = to;
  Edge[cur].next = Head[from];
  Head[from] = cur;
}
void DFS() {
  int Stop = 1;
  Vis[1] = 1, Stack[1] = 1;
  while (Stop) {
    int x = Stack[Stop--];
    for (int h = Head[x]; h != -1; h = Edge[h].next) {
      int y = Edge[h].to;
      if (Vis[y]) continue;
      printf("%d %d\n", x, y);
      Vis[y] = 1, Stack[++Stop] = y;
    }
  }
}
void Print() {
  memset(Head, -1, sizeof(Head));
  for (int i = 1; i <= d; i++) Q[i] = i + 1, Dep[i + 1] = i, Anc[i + 1] = i + 1;
  Degree[1] = Degree[d + 1] = 1;
  for (int i = 2; i <= d; i++) Degree[i] = 2;
  for (int i = 1; i <= d; i++) Add(i, i + 1);
  int head = 1, tail = d;
  for (int j = n; j >= d + 2; j--) {
    while (head <= tail) {
      if (Degree[Q[head]] < k &&
          Dep[Q[head]] - Dep[Anc[Q[head]]] < Dep[Anc[Q[head]]]) {
        Add(Q[head], j), Degree[Q[head]]++, Degree[j]++;
        Q[++tail] = j, Dep[j] = Dep[Q[head]] + 1, Anc[j] = Anc[Q[head]];
        break;
      } else
        head++;
    }
  }
  printf("YES\n");
  DFS();
}
int main() {
  scanf("%d%d%d", &n, &d, &k);
  if (!Check())
    printf("NO\n");
  else
    Print();
  return 0;
}
