#include <bits/stdc++.h>
using namespace std;
const int N = 4e5 + 5;
struct node {
  int u, v;
};
node a[N];
int degree[N], v, n, d, k, top;
void dfs(int u, int MaxL) {
  if (MaxL == 0 || top == n - 1) return;
  while (degree[u] < d) {
    degree[v]++;
    degree[u]++;
    a[top++] = (node){u, v};
    dfs(v++, MaxL - 1);
    if (top == n - 1) return;
  }
}
int main() {
  while (~scanf("%d %d %d", &n, &k, &d)) {
    if (n < k + 1 || (d == 1 && n > 2)) {
      printf("NO\n");
      continue;
    }
    memset(degree, 0, sizeof(degree));
    top = 0;
    degree[1] = degree[k + 1] = 1;
    for (int i = 1; i <= k; i++) {
      a[top++] = (node){i, i + 1};
      if (i != 1) degree[i] = 2;
    }
    int MaxL = 1;
    v = k + 2;
    for (int i = 2, j = k; i <= j; i++, j--, MaxL++) {
      if (top == n - 1) break;
      dfs(i, MaxL);
      if (i != j) dfs(j, MaxL);
    }
    if (top == n - 1) {
      printf("YES\n");
      for (int i = 0; i < top; i++) printf("%d %d\n", a[i].u, a[i].v);
    } else
      printf("NO\n");
  }
  return 0;
}
