#include <bits/stdc++.h>
using namespace std;
struct Rib {
  long long a, b;
};
long long n, d, k, d2 = 0, ans = 0, W[400002];
Rib Ans[400002];
long long num = 2;
bool dcheck = false;
void Build(long long v) {
  d2++;
  if (n > 0) {
    if (W[v] < k) {
      if (d2 < d) {
        Ans[ans].a = v;
        Ans[ans].b = num;
        ans++;
        W[v]++;
        W[num] = 0;
        num++;
        n--;
        Build(num - 1);
      } else {
        if (d2 == d) {
          dcheck = true;
          d2--;
          return;
        }
      }
      while (n > 0 && W[v] < k) {
        Ans[ans].a = v;
        Ans[ans].b = num;
        ans++;
        W[v]++;
        W[num] = 0;
        num++;
        n--;
        Build(num - 1);
      }
    }
  }
  d2--;
  return;
}
int main(int argc, const char* argv[]) {
  cin >> n >> d >> k;
  n--;
  W[1] = 0;
  Build(1);
  if (!dcheck || n > 0) {
    cout << "NO";
    return 0;
  }
  cout << "YES" << endl;
  for (long long i = 0; i < ans; i++) {
    cout << Ans[i].a << ' ' << Ans[i].b << endl;
  }
  return 0;
}
