#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int maxn = 2e5 + 10;
int n, d, k;
int a[maxn];
void print(int a[], int n, int st = 0) {
  for (int i = 0; i < n; i++) {
    if (i != 0) printf(" ");
    printf("%d", a[i + st]);
  }
  printf("\n");
}
void init() { scanf("%d%d%d", &n, &d, &k); }
void no() {
  printf("NO\n");
  exit(0);
}
void doit() {
  if (k == 1) {
    if (n == 2 && d == 1) {
      printf("YES\n1 2\n");
      exit(0);
    } else
      no();
  }
  if (k == 2) {
    if (n >= 3 && n == d + 1) {
      printf("YES\n");
      for (int i = 1; i <= d; i++) printf("%d %d\n", i, i + 1);
      exit(0);
    } else
      no();
  }
  if (n < d + 1) no();
  long long mx = 2;
  for (int i = 1; i < d; i++) {
    long long cur = 1;
    for (int j = 0; j <= min(i, d - i); j++) {
      mx += cur;
      if (mx >= n) break;
      if (j == 0)
        cur *= k - 2;
      else
        cur *= k - 1;
    }
    if (mx >= n) break;
  }
  if (mx < n) no();
  printf("YES\n");
  for (int i = 2; i <= d + 1; i++) printf("%d %d\n", i - 1, i);
  n -= d + 1;
  int cur = d + 1, st, ed = d + 1;
  for (int i = 2; i <= d; i++) {
    st = ed = i;
    for (int j = 1; j <= min(i - 1, d + 1 - i); j++) {
      int son = j == 1 ? k - 2 : k - 1;
      int add = min(n, (ed - st + 1) * son);
      for (int p = 0; p < add; p++) {
        printf("%d %d\n", st + p / son, cur + p + 1);
      }
      n -= add;
      cur += add;
      ed = cur;
      st = ed - add + 1;
      if (n <= 0) break;
    }
    if (n <= 0) break;
  }
}
int main() {
  init();
  doit();
  return 0;
}
