#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, d, k;
  cin >> n >> d >> k;
  if (n == 1 || n - 1 < d || (k == 1 && n > 2)) {
    cout << "NO\n";
    return 0;
  }
  int id = 1, maxDiameter = 0;
  pair<int, int> lowest{-1, 1};
  vector<int> maxed(n);
  vector<pair<int, int>> edges;
  queue<pair<int, pair<int, bool>>> q;
  q.push({-1, {0, false}});
  while (!q.empty() && n > d - maxDiameter) {
    int p = q.front().first, depth = q.front().second.first;
    bool expand = q.front().second.second;
    q.pop();
    if (expand) {
      maxDiameter++;
      if (maxDiameter > d) {
        cout << "NO\n";
        return 0;
      }
    }
    maxed[depth]++;
    lowest = max(lowest, make_pair(depth, id));
    n--;
    if (p != -1) edges.emplace_back(p, id);
    for (int i = 0; i < min(k - (id != 1), n); i++)
      q.push(
          {id,
           {depth + 1, (i == 0 || (i == 1 && id == 1)) && maxed[depth] <= 2}});
    id++;
  }
  if (n < d - maxDiameter || (lowest.second != 1 && n > 0 && k == 1)) {
    cout << "NO\n";
    return 0;
  }
  cout << "YES\n";
  for (auto e : edges) cout << e.first << " " << e.second << "\n";
  while (d > maxDiameter) {
    cout << lowest.second << " " << lowest.second + 1 << "\n";
    lowest.second++;
    maxDiameter++;
  }
  return 0;
}
