#include <bits/stdc++.h>
using namespace std;
const int MAXN = 4e5 + 5;
int NXT = 2;
int n, d, k, dep[MAXN], maxDepth;
vector<int> adj[MAXN];
int main() {
  scanf("%d %d %d", &n, &d, &k);
  if (k == 1 || d == 1) {
    if (n != 2 || d != 1) {
      printf("NO\n");
    } else {
      printf("YES\n");
      printf("1 2\n");
    }
    return 0;
  }
  int l = 1, r = 1;
  dep[1] = 0;
  while (dep[l] + dep[r] < d) {
    if (dep[l] <= dep[r]) {
      adj[NXT].push_back(l);
      adj[l].push_back(NXT);
      dep[NXT] = dep[l] + 1;
      l = NXT;
      ++NXT;
    } else {
      adj[NXT].push_back(r);
      adj[r].push_back(NXT);
      dep[NXT] = dep[r] + 1;
      r = NXT;
      ++NXT;
    }
  }
  if (NXT - 1 > n) {
    printf("NO\n");
    return 0;
  }
  maxDepth = min(dep[l], dep[r]);
  queue<int> lis;
  for (__typeof(NXT) i = (1) - ((1) > (NXT)); i != (NXT) - ((1) > (NXT));
       i += 1 - 2 * ((1) > (NXT)))
    if (dep[i] < maxDepth && adj[i].size() < k) lis.push(i);
  while (NXT <= n && !lis.empty()) {
    int top = lis.front();
    lis.pop();
    while (NXT <= n && adj[top].size() < k) {
      adj[top].push_back(NXT);
      adj[NXT].push_back(top);
      dep[NXT] = dep[top] + 1;
      if (dep[NXT] < maxDepth && adj[NXT].size() < k) lis.push(NXT);
      ++NXT;
    }
  }
  if (NXT <= n && d % 2 == 1) {
    lis.push(2);
    while (NXT <= n && !lis.empty()) {
      int top = lis.front();
      lis.pop();
      for (auto i : adj[top])
        if (i != 1 && dep[i] > dep[top] && dep[i] < dep[l]) lis.push(i);
      while (NXT <= n && adj[top].size() < k) {
        adj[top].push_back(NXT);
        adj[NXT].push_back(top);
        dep[NXT] = dep[top] + 1;
        if (dep[NXT] < dep[l] && adj[NXT].size() < k) lis.push(NXT);
        ++NXT;
      }
    }
  }
  if (NXT - 1 != n) {
    printf("NO\n");
    return 0;
  }
  printf("YES\n");
  for (__typeof(NXT) i = (1) - ((1) > (NXT)); i != (NXT) - ((1) > (NXT));
       i += 1 - 2 * ((1) > (NXT))) {
    for (auto j : adj[i])
      if (i < j) {
        printf("%d %d\n", i, j);
      }
  }
}
