#include <bits/stdc++.h>
using namespace std;
int n, d, k;
int node_index;
int dfs(int num, int u) {
  int avg = (num - 1) / (k - 1);
  for (int i = 1; i <= k - 1; i++) {
    int next_num = avg + (i <= ((num - 1) % (k - 1)) ? 1 : 0);
    if (next_num == 0) continue;
    int v = ++node_index;
    printf("%d %d\n", u, v);
    dfs(next_num, v);
  }
  return 0;
}
int main() {
  scanf("%d%d%d", &n, &d, &k);
  int tmp1, tmp2, sum2, sum;
  tmp1 = tmp2 = 1;
  sum = 1;
  sum2 = 0;
  if (d >= 2) {
    tmp1 *= k;
    sum += tmp1;
    sum2 += 1;
  }
  for (int i = 4; i <= d; i += 2) {
    tmp1 *= (k - 1);
    sum += tmp1;
    sum2 += tmp1 / k;
  }
  if (d % 2 == 1) {
    for (int i = 1; i <= n; i++) tmp2 *= (k - 1);
  } else
    tmp2 = 0;
  if (sum + tmp2 >= n)
    printf("YES\n");
  else {
    printf("NO\n");
    exit(0);
  }
  node_index = k + 1;
  for (int i = 1; i <= k; i++) {
    if (d % 2 == 1) {
      int remain = n - 1 - k * sum2;
      if (i == 1) {
        if (remain + sum2) {
          printf("1 %d\n", i + 1);
          dfs(remain + sum2, i + 1);
        }
      } else {
        if (sum2) {
          dfs(sum2, i + 1);
          printf("1 %d\n", i + 1);
        }
      }
    } else {
      int avg = (n - 1) / k;
      int remain = (n - 1) % k;
      if (avg + (i <= remain ? 1 : 0)) {
        dfs(avg + (i <= remain ? 1 : 0), i + 1);
        printf("1 %d\n", i + 1);
      }
    }
  }
  return 0;
}
