#include <bits/stdc++.h>
using namespace std;
vector<int> adj[400009];
int n, d, k;
int curvertex;
void add_branch(int index, int depth, int degree) {
  int i;
  if (depth == 0 || curvertex >= n) return;
  for (i = 0; i < degree; i++) {
    adj[index].push_back(curvertex);
    adj[curvertex].push_back(index);
    curvertex++;
    add_branch(curvertex - 1, depth - 1, k - 1);
    if (curvertex >= n) return;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> d >> k;
  int i, j;
  if (k == 1 && (n != 2 || d != 1)) {
    cout << "NO";
    return 0;
  }
  for (i = 0; i < d; i++) {
    adj[i].push_back(i + 1);
    adj[i + 1].push_back(i);
  }
  curvertex = d + 1;
  for (i = 1; i <= (d - 1) / 2; i++) {
    add_branch(i, i, k - 2);
    add_branch(d - i, i, k - 2);
  }
  if (d % 2 == 0) add_branch(d / 2, d / 2, k - 2);
  if (curvertex != n) {
    cout << "NO";
    return 0;
  } else {
    cout << "YES\n";
    for (i = 0; i < n; i++) {
      for (auto it = adj[i].begin(); it != adj[i].end(); it++) {
        if ((*it) > i) cout << i + 1 << " " << (*it) + 1 << endl;
      }
    }
  }
  return 0;
}
