#include <bits/stdc++.h>
using namespace std;
vector<int> lev[4 * 100005];
vector<int> adj[4 * 100005];
int bp[4 * 100005];
int n, d, k;
set<pair<int, int> > ss;
int main() {
  cin >> n >> d >> k;
  lev[0].push_back(1);
  adj[1].push_back(2);
  adj[2].push_back(1);
  lev[1].push_back(2);
  bp[1] = 1;
  bp[2] = 2;
  d -= 2;
  for (int i = 0; i < d / 2; i++) {
    adj[2 + i].push_back(3 + i);
    adj[3 + i].push_back(2 + i);
    lev[i + 2].push_back(3 + i);
    bp[i + 3] = 2;
  }
  adj[1].push_back(3 + d / 2);
  adj[3 + d / 2].push_back(1);
  lev[1].push_back(3 + d / 2);
  for (int i = 0; i < (d + 1) / 2; i++) {
    adj[3 + d / 2 + i].push_back(4 + d / 2 + i);
    adj[4 + d / 2 + i].push_back(3 + d / 2 + i);
    lev[i + 2].push_back(4 + d / 2 + i);
    bp[4 + d / 2 + i] = 3;
  }
  int lc = 4 + d / 2 + (d + 1) / 2;
  for (int i = 0; i < 1 + (d + 1) / 2 && lc <= n; i++) {
    for (int j = 0; j < lev[i].size(); j++) {
      if (bp[lev[i][j]] == 2 && (d % 2 == 1) && (i == (d + 1) / 2)) continue;
      while (lc <= n && adj[lev[i][j]].size() < k) {
        adj[lev[i][j]].push_back(lc);
        adj[lc].push_back(lev[i][j]);
        bp[lc] = bp[lev[i][j]];
        lev[i + 1].push_back(lc);
        lc++;
      }
    }
  }
  if (lc != n + 1) {
    cout << "NO" << endl;
    return 0;
  }
  for (int i = 1; i <= n; i++) {
    if (adj[i].size() > k) {
      cout << "NO" << endl;
      return 0;
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < adj[i].size(); j++) {
      pair<int, int> a = {i, adj[i][j]};
      if (a.first > a.second) swap(a.first, a.second);
      ss.insert(a);
    }
  }
  if (ss.size() != n - 1) {
    cout << "NO" << endl;
    return 0;
  }
  cout << "YES" << endl;
  for (auto it = ss.begin(); it != ss.end(); it++) {
    printf("%d %d\n", (*it).first, (*it).second);
  }
  return 0;
}
