#include <bits/stdc++.h>
using ll = long long;
using namespace std;
vector<ll> ans[400009];
ll n, d, k;
ll c;
void newd(ll x, ll y, ll z) {
  if (y == 0 || c >= n) return;
  for (ll i = 0; i < z; i++) {
    ans[x].push_back(c);
    ans[c].push_back(x);
    c++;
    newd(c, y - 1, k - 1);
    if (c >= n) return;
  }
}
int main() {
  cin >> n >> d >> k;
  c = d + 1;
  for (ll i = 0; i < d; i++) {
    ans[i].push_back(i + 1);
    ans[i + 1].push_back(i);
  }
  if (k == 1) {
    if (n != 2 || d != 1) {
      cout << "NO\n";
      return 0;
    }
  }
  for (ll i = 1; i <= (d - 1) / 2; i++) {
    newd(i, i, k - 2);
    newd(d - i, i, k - 2);
  }
  if (d % 2 == 0) newd(d / 2, d / 2, k - 2);
  if (c != n) {
    cout << "NO\n";
    return 0;
  } else {
    cout << "YES\n";
    for (ll i = 0; i < n; i++) {
      for (auto mp = ans[i].begin(); mp != ans[i].end(); mp++) {
        if ((*mp) > i) cout << i + 1 << " " << (*mp) + 1 << "\n";
      }
    }
  }
  return 0;
}
