#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, d, k;
  cin >> n >> k >> d;
  if (n - 1 < k) return cout << "NO", 0;
  if (d == 1 || n == 2 || k == 1) {
    if (n == 2 && k == 1 && d >= 1)
      cout << "YES\n1 2";
    else
      cout << "NO";
    return 0;
  }
  vector<vector<int> > edges(n);
  int currNode = 1;
  for (int i = 1; i <= ceil(k * 0.5); i++) {
    edges[i - 1].push_back(i);
    currNode++;
  }
  int stopNode1 = currNode - 1;
  edges[0].push_back(currNode);
  currNode++;
  for (int i = 1; i < k / 2; i++) {
    edges[currNode - 1].push_back(currNode);
    currNode++;
  }
  int stopNode2 = currNode - 1;
  queue<int> q;
  q.push(0);
  while (!q.empty() && currNode != n) {
    int node = q.front();
    q.pop();
    for (int ch : edges[node]) {
      q.push(ch);
    }
    if (node == stopNode1 || node == stopNode2) break;
    while (edges[node].size() + (node != 0) < d && currNode != n) {
      edges[node].push_back(currNode);
      q.push(currNode);
      currNode++;
    }
  }
  if (currNode != n)
    cout << "NO";
  else {
    cout << "YES\n";
    for (int i = 0; i < n; i++) {
      for (int ch : edges[i]) {
        cout << i + 1 << " " << ch + 1 << endl;
      }
    }
  }
  return 0;
}
