#include <bits/stdc++.h>
using namespace std;
const int N = 4e5 + 7;
int n, d, k, now;
long long f[N];
long long sum;
void linkline(int x, int ceil, int num) {
  if (ceil == 0) return;
  for (int i = 1; i <= num; i++) {
    now++;
    printf("%d %d\n", x, now);
    if (now == n) return;
    linkline(now, ceil - 1, num);
    if (now == n) return;
  }
}
int main() {
  scanf("%d%d%d", &n, &d, &k);
  if (d >= n) {
    printf("NO\n");
    return 0;
  }
  if (k == 1) {
    if (n == 2 && d == 1)
      printf("YES\n");
    else
      printf("NO\n");
    return 0;
  }
  f[1] = k - 2;
  for (int i = 1; i <= n; i++) {
    int tmp = k - 1;
    f[i] = f[i - 1] + tmp;
    tmp = tmp * (k - 1);
    if (f[i] > n) break;
  }
  int N = n;
  N = N - d - 1;
  if (N == 0) {
    printf("YES\n");
    for (int i = 1; i <= n - 1; i++) {
      printf("%d %d\n", i, i + 1);
    }
    return 0;
  }
  int mid = (d / 2) - 1;
  for (int i = 1; i <= d + 1; i++) {
    int tmp = min(i - 1, d + 1 - i);
    sum += f[tmp];
  }
  if (sum < N) {
    printf("NO\n");
    return 0;
  }
  printf("YES\n");
  for (int i = 1; i <= d; i++) {
    printf("%d %d\n", i, i + 1);
  }
  now = d + 1;
  for (int i = 1; i <= d + 1; i++) {
    int tmp = min(i - 1, d + 1 - i);
    if (tmp == 0) continue;
    if (now == n) return 0;
    for (int j = 1; j <= k - 2; j++) {
      now++;
      printf("%d %d\n", i, now);
      if (now == n) return 0;
      linkline(now, tmp - 1, k - 1);
      if (now == n) return 0;
    }
  }
}
