#include <bits/stdc++.h>
using namespace std;
int n, d, k;
int tot, cnt;
void dfs(int u, int lev, int ch) {
  if (!lev) return;
  for (int i = (1); i <= (ch); i += (1)) {
    int v = ++cnt;
    printf("%d %d\n", u, v);
    if (cnt == tot) return;
    dfs(v, lev - 1, k - 1);
    if (cnt == tot) return;
  }
}
void construct() {
  if (~d & 1) {
    for (int i = (1); i <= (d); i += (1)) printf("%d %d\n", i, i + 1);
    tot = n;
    cnt = d + 1;
    if (cnt == tot) return;
    for (int i = (2); i <= (d); i += (1)) {
      dfs(i, min(i - 1, d + 1 - i), k - 2);
      if (cnt == tot) return;
    }
  } else {
    d--;
    for (int i = (1); i <= (d); i += (1)) printf("%d %d\n", i, i + 1);
    tot = n;
    cnt = d + 1;
    if (cnt == tot) return;
    dfs(1, 1, k - 1);
    if (cnt == tot) return;
    for (int i = (2); i <= (d); i += (1)) {
      dfs(i, min(i, d + 1 - i), k - 2);
      if (cnt == tot) return;
    }
  }
}
int main() {
  scanf("%d %d %d", &n, &d, &k);
  if (k == 1) {
    if (d == 1 && n == 2) {
      printf("YES\n1 2\n");
    } else {
      printf("NO\n");
    }
    return 0;
  }
  if (d == 1) {
    if (n == 2 && k >= 1) {
      printf("YES\n1 2\n");
    } else {
      printf("NO\n");
    }
    return 0;
  }
  int mn = d + 1;
  if (n < mn) {
    printf("NO\n");
    return 0;
  }
  long long pdt = k, sum = k + 1;
  if (sum >= n) {
    printf("YES\n");
    construct();
    return 0;
  }
  for (int i = (2); i <= (d / 2); i += (1)) {
    pdt *= (k - 1);
    sum += pdt;
    if (sum >= n) {
      printf("YES\n");
      construct();
      return 0;
    }
  }
  if (~d & 1) {
    printf("NO\n");
  } else {
    pdt = pdt / k * (k - 1);
    sum += pdt;
    if (sum >= n) {
      printf("YES\n");
      construct();
    } else {
      printf("NO\n");
    }
  }
  return 0;
}
