#include <bits/stdc++.h>
using namespace std;
int n, ind, k;
void build_tree(int p, int d, int pos) {
  if (d == 0) return;
  for (int i = 0; i < pos; i++) {
    if (ind > n) return;
    cout << p << ' ' << ind++ << endl;
    build_tree(ind - 1, d - 1, k - 1);
  }
}
bool check(int d, int mx) {
  if (d & 1) {
    if ((d - 1) / 2 == mx) return false;
    return true;
  } else {
    if ((d - 2) / 2 == mx) return false;
    return true;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int d, i, j;
  cin >> n >> d >> k;
  int vrtx = 0;
  int t_d = (d - 1) / 2;
  for (i = 1; i <= t_d; i++) {
    vrtx = (vrtx + 1) * (k - 1);
  }
  (d & 1) ? vrtx = vrtx* 2 + 2 : vrtx = (vrtx + 1) * k + 1;
  if (n > vrtx || n <= d) return cout << "NO" << endl, 0;
  if (k == 1) {
    if (n == 2)
      cout << "YES" << endl << 1 << ' ' << 2 << endl;
    else
      cout << "NO" << endl;
    return 0;
  }
  cout << "YES" << endl;
  for (i = 1; i <= d; i++) cout << i << ' ' << i + 1 << endl;
  ind = d + 2;
  for (i = 0; i < d; i++) build_tree(i + 1, min(i, d - i), k - 2);
}
