#include <bits/stdc++.h>
using namespace std;
queue<int> q;
int n, d, k, l, r;
int LYQ, xy, QQH, ans;
int depth[400005], vis[400005], maxx[400005];
void BFS(int j) {
  q.push(j);
  while (q.size()) {
    int x = q.front();
    q.pop();
    r = min(l + k - 1, n + 1);
    for (int i = l; i < r; i++) {
      printf("%d %d\n", x, i);
      q.push(i);
    }
    l = r;
    if (r == n + 1) break;
  }
}
int main() {
  scanf("%d%d%d", &n, &d, &k);
  k--;
  if (d >= n || (k == 0 && n > 2))
    printf("NO\n");
  else {
    if (k == 1) {
      if (d != (n - 1))
        printf("NO\n");
      else {
        printf("YES\n");
        for (int i = 1; i < n; i++) printf("%d %d\n", i, i + 1);
      }
    } else {
      xy = 1;
      for (int i = 0; i != -1; i++) {
        LYQ += xy;
        if (i)
          xy *= k;
        else
          xy *= (k + 1);
        if (LYQ > n) {
          xy /= k;
          LYQ -= xy;
          QQH = i - 1;
          break;
        }
      }
      QQH *= 2;
      if (LYQ != n) QQH++;
      if ((n - LYQ) > (xy / k)) QQH++;
      if (QQH > d)
        printf("NO\n");
      else {
        printf("YES\n");
        xy = d / 2;
        for (int i = 1; i <= n; i++) maxx[i] = xy;
        for (int i = xy + 2; i <= d + 1; i++) maxx[i] = xy + 1;
        for (int i = 1; i <= xy; i++) {
          printf("%d %d\n", i, i + 1);
          depth[i + 1] = depth[i] + 1;
          vis[i] = 1;
        }
        printf("%d %d\n", 1, xy + 2);
        depth[xy + 2] = 1;
        for (int i = xy + 2; i <= d; i++) {
          vis[i] = 1;
          printf("%d %d\n", i, i + 1);
          depth[i + 1] = depth[i] + 1;
        }
        l = r = d + 2;
        vis[xy + 1] = vis[d + 1] = 1;
        for (int i = 1; i <= xy; i++) BFS(i);
        if (r != n + 1)
          for (int i = xy + 2; i <= d; i++) BFS(i);
      }
    }
  }
}
