#include <bits/stdc++.h>
using namespace std;
int n, d, k, t, i, tamaj;
bool boyo;
void boyos(int k, int d) {
  int aw = d + 1;
  for (int i = 2; i <= d; ++i) {
    int t = min(i - 1, d - i + 1);
    int bolta = k - 2;
    aw += bolta;
    if (aw >= n) {
      boyo = 1;
      return;
    }
    for (int j = 1; j < t; ++j) {
      bolta *= k - 1;
      aw += bolta;
      if (aw >= n) {
        boyo = 1;
        return;
      }
    }
  }
}
void bu(int dg, int tao, int daw) {
  if (tao == tamaj) {
    return;
  }
  for (int i = daw; i < k; ++i) {
    ++t;
    cout << dg << " " << t << "\n";
    if (t == n) {
      exit(0);
    }
    bu(t, tao + 1, 1);
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> d >> k;
  if (n == 2) {
    if (d != 1) {
      cout << "NO\n";
      return 0;
    }
    cout << "YES\n1 2\n";
    return 0;
  }
  if (n <= d || k == 1 || (k == 2 && n != d + 1)) {
    cout << "NO\n";
    return 0;
  }
  boyos(k, d);
  if (!boyo) {
    cout << "NO\n";
    return 0;
  }
  cout << "YES\n";
  for (i = 1; i <= d; ++i) {
    cout << i << " " << i + 1 << "\n";
  }
  if (n == d + 1) {
    return 0;
  }
  t = d + 1;
  for (i = 2; i <= d; ++i) {
    tamaj = min(i - 1, d - i + 1);
    bu(i, 0, 2);
  }
}
