#include <bits/stdc++.h>
using namespace std;
const int N = 4e5 + 10;
struct P {
  int v, f, h;
  bool operator<(const P &p) const { return h > p.h; }
};
int e[N];
int main(void) {
  std::ios::sync_with_stdio(false);
  int n, d, k;
  cin >> n >> d >> k;
  int t = k, h = 1;
  while (t < n) t *= t, h++;
  h++;
  if (h > d)
    cout << "NO" << endl;
  else {
    cout << "YES" << endl;
    priority_queue<P> q;
    int idx = 0, cnt = 0;
    for (int i = 1; i <= d; i++)
      q.push({++idx, idx - 1, i}), e[idx - 1]++, e[idx]++;
    e[1]--;
    while (!q.empty() && cnt != n) {
      P u = q.top();
      q.pop(), cnt++;
      if (u.f) cout << u.f << ' ' << u.v << endl;
      while (e[u.v] != k && idx < n)
        q.push({++idx, u.v, u.h + 1}), e[u.v]++, e[idx]++;
    }
  }
  return 0;
}
