#include <bits/stdc++.h>
using namespace std;
long long n, d, k;
const int MAXN = 400005;
vector<pair<long long, long long> > ans;
long long level[MAXN];
int main() {
  ios::sync_with_stdio(0);
  cin >> n >> d >> k;
  long long big = 1, curr = 1;
  level[0] = 1;
  for (int i = 1; i <= d - 1; i++) {
    if (curr >= 1e18 / (k - 1)) {
      big = 1e18;
      level[i] = big;
      break;
    }
    if (i == 1)
      curr *= k;
    else
      curr *= (k - 1);
    big += curr;
    level[i] = big;
  }
  if (n > big || n <= d) {
    cout << "NO\n";
    return 0;
  }
  cout << "YES\n";
  long long idx = 0, l = 0, left = n - 1;
  for (int i = 1; i < n; i++) {
    if (d - 2 * l < left) {
      ans.push_back(make_pair(idx, i));
      if (idx == 0) {
        if (i % k == 0) idx++;
      } else if ((i - 1) % (k - 1) == 0)
        idx++;
      left--;
      if (i == level[l]) l++;
    } else
      ans.push_back(make_pair(i - 1, i));
  }
  for (int i = 0; i < ans.size(); i++)
    cout << ans[i].first + 1 << " " << ans[i].second + 1 << "\n";
  return 0;
}
