#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0) {
    return a;
  }
  return gcd(b, a % b);
}
struct poing {
  int x;
  int y;
  int comp(poing a) {
    if (x == a.x) {
      if (y == a.y) {
        return -1;
      }
      return x;
    }
    if (x == a.y) {
      if (y == a.x) {
        return -1;
      }
      return x;
    }
    if (y == a.x || y == a.y) {
      return y;
    }
    return -1;
  }
};
int countdig(long long n) {
  if (n == 1) {
    return 0;
  }
  return countdig(n / 2) + 1;
}
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  int d;
  cin >> d;
  int k;
  cin >> k;
  if (n == 1) {
    cout << "YES" << endl;
    return 0;
  }
  if (n == 2 && d == 1) {
    cout << "YES" << endl;
    cout << "1 2" << endl;
  }
  if (k == 1 || d == 1 || d >= n) {
    cout << "NO" << endl;
    return 0;
  }
  long long left = n - k - 1;
  long long cur = k;
  long long more = d - 2;
  while (more >= 2 && left > 0) {
    cur *= k - 1;
    left -= cur;
    more -= 2;
  }
  if (more == 1) {
    left -= (cur / k) * (k - 1);
  }
  if (left > 0) {
    cout << "NO" << endl;
    return 0;
  }
  cout << "YES" << endl;
  queue<pair<long long, long long> > f;
  int sum = n - 1;
  f.push(make_pair(0, 1));
  for (int i = 1; i < k; i += 1) {
    f.push(make_pair(0, 2));
    sum--;
  }
  int me = 1;
  while (me < n) {
    int fn = f.front().first + 1;
    int depth = f.front().second;
    f.pop();
    for (int j = 0; j < k - 1; j += 1) {
      if (sum <= 0) {
        break;
      }
      f.push(make_pair(me, 2 + depth));
      sum--;
    }
    cout << fn << ' ' << me + 1 << endl;
    me++;
    if (d - depth == n - me) {
      break;
    }
  }
  while (me < n) {
    cout << me << ' ' << me + 1 << endl;
    me++;
  }
  return 0;
}
