#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > ans;
int main() {
  int n, d, k, new_start, deg;
  cin >> n >> d >> k;
  d++;
  if (d > n) {
    printf("NO");
    return 0;
  }
  if (k == 1) {
    if (n == 2)
      printf("YES\n1 2");
    else
      printf("NO");
    return 0;
  }
  for (int i = 1; i < d; i++) ans.push_back({i, i + 1});
  int cur = d + 1, start = 2, finish = d - 1;
  for (int dist = 1, pow = (k - 2); dist < (d + 1) / 2 && cur <= n; ++dist) {
    new_start = cur;
    for (int v = start; v <= finish; ++v) {
      if (dist == 1)
        deg = 2;
      else
        deg = 1;
      for (; deg < k && cur <= n; ++deg, ++cur) ans.push_back({v, cur});
    }
    start = new_start + pow;
    finish = (cur - 1) - pow;
    if (pow * 1LL * (k - 1) >= 1e9) break;
    pow *= (k - 1);
  }
  if (cur <= n)
    cout << "NO\n";
  else {
    cout << "YES\n";
    for (auto p : ans) printf("%d %d\n", p.first, p.second);
  }
}
