#include <bits/stdc++.h>
int n, d, k;
int calc(int num) {
  int i = 1, sum = 0;
  while (sum + i < num) {
    sum += i;
    i *= 3;
    i++;
  }
  return i;
}
int main() {
  int i, last;
  scanf("%d %d %d", &n, &d, &k);
  if (pow(k, d - 1) + 1 < n) {
    printf("NO");
    exit(0);
  }
  printf("YES\n");
  last = 1;
  for (i = 2; i <= n; i++) {
    printf("%d %d\n", last, i);
    last = (i - 1) / 3 + 1;
    if (n - i == k - calc(last)) last = i;
  }
}
