#include <bits/stdc++.h>
using namespace std;
const int maxn = 400040;
struct edge {
  int u, v;
};
int n, d, k;
int halfd = 0;
int tot = 0;
int deg[maxn];
int dep[maxn];
vector<edge> ans;
queue<int> q;
inline void pre() {
  int u = q.front();
  q.pop();
  int v = -1;
  if (!q.empty()) {
    v = q.front();
    q.pop();
  } else
    v = u;
  dep[u] = dep[v] = 0;
  int tu = u;
  for (register int i = 1; i <= halfd; i++) {
    deg[tu]++;
    if (tu != u && deg[tu] < k && dep[tu] < halfd) q.push(tu);
    ++tot;
    deg[tot]++;
    dep[tot] = dep[tu] + 1;
    ans.push_back((edge){tu, tot});
    tu = tot;
  }
  int tv = v;
  for (register int i = 1; i <= halfd; i++) {
    deg[tv]++;
    if (tv != v && deg[tv] < k && dep[tv] < halfd) q.push(tv);
    ++tot;
    deg[tot]++;
    dep[tot] = dep[tv] + 1;
    ans.push_back((edge){tv, tot});
    tv = tot;
  }
  if (u != v) {
    if (deg[u] != k) {
      q.push(u);
      q.push(v);
    }
  } else {
    if (deg[u] != k) {
      q.push(u);
    }
  }
}
inline void creat() {
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    if (dep[u] == halfd) continue;
    while (deg[u] < k) {
      ++tot;
      deg[u]++;
      deg[tot]++;
      dep[tot] = dep[u] + 1;
      q.push(tot);
      ans.push_back((edge){u, tot});
      if (tot == n) return;
    }
  }
}
int main() {
  scanf("%d%d%d", &n, &d, &k);
  if (k == 1) {
    if (d >= 2) {
      printf("NO\n");
      return 0;
    }
    if (n > 2) {
      printf("NO\n");
      return 0;
    }
    printf("YES\n");
    if (n == 2) {
      printf("1 2\n");
    } else if (n == 1) {
      printf("1\n");
    }
    return 0;
  }
  halfd = d / 2;
  if (d & 1) {
    tot = 2;
    deg[1] = deg[2] = 1;
    q.push(1);
    q.push(2);
    ans.push_back((edge){1, 2});
    pre();
  } else {
    tot = 1;
    deg[1] = 0;
    q.push(1);
    pre();
  }
  if (tot == n) {
    printf("YES\n");
    for (register int i = 0; i < (int)ans.size(); i++) {
      edge now = ans[i];
      printf("%d %d\n", now.u, now.v);
    }
    return 0;
  }
  creat();
  if (tot != n) {
    printf("NO\n");
    return 0;
  } else {
    printf("YES\n");
  }
  for (register int i = 0; i < (int)ans.size(); i++) {
    edge now = ans[i];
    printf("%d %d\n", now.u, now.v);
  }
  return 0;
}
