#include <bits/stdc++.h>
using namespace std;
int read() {
  int nm = 0, f = 1;
  char c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-') f = -1;
  for (; isdigit(c); c = getchar()) nm = nm * 10 + c - '0';
  return nm * f;
}
int n, d, k, sz[400050], fa[400050], note[400050];
bool f[400050];
void insert(int l, int r) {
  int dd = 1;
  for (int i = 1; i <= n; i += dd) {
    f[i] = true;
    dd *= d;
  }
  for (int i = l - 1; i >= 1; i--) {
    if (f[i - 1] = true) {
      fa[l] = i;
      for (int j = l + 1; j <= r; j++) fa[j] = j - 1;
      return;
    }
  }
}
int main() {
  n = read(), k = read(), d = read();
  if (k > n) {
    return puts("NO");
  }
  if (d == 1) {
    if (k != n - 1) return puts("NO");
    for (int i = 1; i < n; i++) {
      printf("%d %d\n", i, i + 1);
    }
  } else {
    bool flag = true;
    int ans = 0, mi = 1, now = 1;
    while (now <= n) {
      now += mi;
      ans++;
      note[ans] = now - mi + 1;
      if (now >= n) break;
      now += mi * (d - 1);
      ans++;
      note[ans] = now - mi * (d - 1) + 1;
      if (now >= n) break;
      mi *= d;
    }
    if (ans > k) return puts("NO");
    ans = 1, now = 1;
    for (int i = 2; i <= n; i++) {
      if (sz[ans] == d) ans++;
      fa[i] = ans;
      sz[ans]++;
      if (i > note[now] && note[now + 1]) now++;
      if (n - i + now == k) {
        insert(i + 1, n);
        break;
      }
    }
    puts("YES");
    for (int i = 2; i <= n; i++) {
      printf("%d %d\n", fa[i], i);
    }
  }
  return 0;
}
