#include <bits/stdc++.h>
using namespace std;
long long n, d, k;
vector<vector<int>> E;
void printans() {
  for (int i = 0; i < E.size(); i++) {
    for (int j = 0; j < E[i].size(); j++) {
      if (i < E[i][j]) {
        cout << i << " " << E[i][j] << endl;
      }
    }
  }
}
int main() {
  cin >> n >> d >> k;
  E.resize(n + 1);
  if (d > n - 1) {
    cout << "NO" << endl;
    return 0;
  }
  long long tmp = k;
  bool f = false;
  for (int i = 0; i <= (d + 1) / 2; i++) {
    if (tmp >= n * (k - 1) + 1) {
      f = true;
      break;
    }
    tmp *= k;
  }
  if (!f) {
    cout << "NO" << endl;
    return 0;
  }
  cout << "YES" << endl;
  int ncnt = 2;
  int bef = 1;
  for (int i = 0; i < d / 2; i++) {
    E[bef].push_back(ncnt), E[ncnt].push_back(bef);
    bef = ncnt;
    ncnt++;
  }
  bef = 1;
  for (int i = 0; i < d - d / 2; i++) {
    E[bef].push_back(ncnt), E[ncnt].push_back(bef);
    bef = ncnt;
    ncnt++;
  }
  queue<pair<int, int>> Q;
  Q.push(pair<int, int>(1, -1));
  while (Q.size()) {
    auto nfront = Q.front();
    Q.pop();
    int nowpos = nfront.first;
    if (ncnt == n + 1) {
      printans();
      return 0;
    }
    int memo = E[nowpos].size();
    for (int i = E[nowpos].size(); i < k; i++) {
      if (ncnt == n + 1) {
        printans();
        return 0;
      }
      E[nowpos].push_back(ncnt), E[ncnt].push_back(nowpos);
      Q.push(pair<int, int>(ncnt, nowpos));
      ncnt++;
    }
    if (ncnt == n + 1) {
      printans();
      return 0;
    }
    for (int i = 0; i < memo; i++) {
      Q.push(pair<int, int>(E[nowpos][i], nowpos));
    }
    if (ncnt == n + 1) {
      printans();
      return 0;
    }
  }
  return 0;
}
