#include <bits/stdc++.h>
using namespace std;
const int maxn = 4e5 + 10;
struct edge {
  int x, y;
} e[maxn];
int n, d, k, cnt = 1;
void dfs(int x, int id) {
  if (cnt == n) return;
  if (x == 0) return;
  for (int i = 1; i < k; i++) {
    e[cnt++] = (edge){id, cnt};
    dfs(x - 1, cnt);
    if (cnt == n) return;
  }
}
void out() {
  printf("YES\n");
  for (int i = 1; i < cnt; i++) printf("%d %d\n", e[i].x, e[i].y);
}
int main() {
  scanf("%d%d%d", &n, &d, &k);
  for (int i = 1; i <= d; i++) e[cnt++] = (edge){i, i + 1};
  for (int i = 2; i <= d; i++) {
    for (int j = 1; j <= k - 2; j++) {
      e[cnt++] = (edge){i, cnt};
      dfs(min(i - 1, d + 1 - i) - 1, cnt);
      if (cnt == n) break;
    }
    if (cnt == n) break;
  }
  if (cnt == n)
    out();
  else
    printf("NO\n");
  return 0;
}
