#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > ans;
queue<pair<int, int> > q;
int main() {
  int n, d, k;
  cin >> n >> d >> k;
  for (int i = 1; i <= d; i++) ans.push_back(make_pair(i, i + 1));
  int run = d + 2;
  for (int i = 2; i <= d; i++) {
    while (!q.empty()) q.pop();
    int depth = min(i - 1, d + 1 - i);
    for (int j = 0; j < k - 2 && run <= n; j++, run++) {
      q.push(make_pair(run, 1));
      ans.push_back(make_pair(i, run));
    }
    while (!q.empty()) {
      int curr = q.front().first;
      int steps = q.front().second;
      q.pop();
      if (steps < depth) {
        for (int j = 0; j < k - 1 && run <= n; j++, run++) {
          q.push(make_pair(run, steps + 1));
          ans.push_back(make_pair(curr, run));
        }
      }
    }
  }
  if (ans.size() < n - 1)
    cout << "NO\n";
  else {
    cout << "YES\n";
    for (int i = 0; i < ans.size(); i++)
      printf("%d %d\n", ans[i].first, ans[i].second);
  }
}
