#include <bits/stdc++.h>
int pow(int a, int b) {
  int ret = 1, base = a;
  while (b) {
    if (b & 1) ret *= base;
    base *= base;
    b >>= 1;
  }
  return ret;
}
int most, n, d, k, all;
int deg[400005], dep[400005];
void dfs(int u, int dep) {
  if (all == n || dep >= most) return;
  while (deg[u] != k && all != n) {
    printf("%d %d\n", u, ++all);
    deg[u]++;
    deg[all]++;
    dfs(all, dep + 1);
  }
}
inline int mabs(const int &aa) {
  if (aa > 0)
    return aa;
  else
    return -aa;
}
int main() {
  scanf("%d%d%d", &n, &d, &k);
  most = d / 2;
  if (d & 1) {
    if (k == 2) {
      if (k + 1 < n) {
        puts("NO");
        return 0;
      }
    } else if (k * (pow(k - 1, most) - 1) + k < n) {
      puts("NO");
      return 0;
    }
  } else {
    if (k == 2) {
      if (k + 1 < n) {
        puts("NO");
        return 0;
      }
    } else if (k * (pow(k - 1, most) - 1) + 1 < n) {
      puts("NO");
      return 0;
    }
  }
  puts("YES");
  if (d & 1) most++;
  for (int i = 1; i < d; i++) {
    deg[i]++;
    deg[i + 1]++;
    printf("%d %d\n", i, i + 1);
    dep[i] = mabs(most - i);
  }
  dep[d] = d - most;
  all = d;
  if (d & 1) most--;
  for (int i = 1; i <= d; i++) {
    if (all == n) break;
    while (deg[i] != k && all != n) {
      all++;
      deg[i]++;
      deg[all]++;
      printf("%d %d\n", i, all);
      dfs(all, dep[i] + 1);
    }
  }
}
