#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  int n, d, k, cant = 0;
  cin >> n >> d >> k;
  int tab[n + 10];
  fill(tab, tab + n + 10, 1e9);
  vector<int> adj[n + 10];
  for (int i = 1; i <= d; i++) {
    adj[i].push_back(i + 1);
    adj[i + 1].push_back(i);
  }
  tab[1] = 0;
  tab[d + 1] = 0;
  for (int i = 2; i <= d; i++) {
    int mi = 1e9;
    for (int j = 0; j < adj[i].size(); j++) {
      mi = min(mi, tab[adj[i][j]] + 1);
    }
    tab[i] = mi;
  }
  queue<int> q;
  int now = d + 1;
  for (int i = 2; i <= d; i++) {
    if (tab[i] <= d && adj[i].size() <= k) q.push(i);
  }
  while (!q.empty() && now != n + 1) {
    int u = q.front();
    q.pop();
    if (now != n + 1 && tab[u] + 1 != d)
      for (int i = 0; i < k - adj[u].size(); i++) {
        now++;
        if (now == n + 1) break;
        adj[u].push_back(now);
        adj[now].push_back(u);
        tab[now] = tab[u] + 1;
        q.push(now);
        if (now == n) now++;
      }
    if (now == n + 1) {
      break;
    }
  }
  if (n + 1 != now) cant = 1;
  set<int> s[n + 10];
  if (cant == 1) {
    cout << "NO\n";
  } else {
    cout << "YES\n";
    for (int i = 1; i <= n; i++) {
      for (int j = 0; j < adj[i].size(); i++) {
        int sec = adj[i][j];
        if (i > sec) cout << i << " " << sec << endl;
      }
    }
  }
}
