#include <bits/stdc++.h>
using namespace std;
vector<vector<long long>> g;
vector<long long> st;
long long nkk;
long long ind = 0;
long long k;
void rec(long long v, long long col) {
  while (true) {
    if (col > 0 && nkk > 0 && st[v] < k) {
      g[v].push_back(++ind);
      st[v]++;
      st[ind]++;
      nkk--;
      rec(ind, col - 1);
    } else {
      break;
    }
  }
}
int solve() {
  long long n, d;
  cin >> n >> d >> k;
  g.resize(n);
  st.resize(n * 4, 0);
  nkk = n;
  if (n <= d) {
    cout << "NO\n";
    return 0;
  }
  for (long long i = 0; i < d; ++i) {
    g[ind].push_back(++ind);
    if ((st[ind] + 1) <= k && (st[ind - 1] + 1) <= k) {
      st[ind]++;
      st[ind - 1]++;
      nkk--;
    } else {
      cout << "NO\n";
      return 0;
    }
  }
  nkk--;
  long long last = ind;
  for (long long i = 0; i <= last; ++i) {
    long long r = max(0LL, d - max(i, abs(last - i)));
    rec(i, r);
  }
  if (nkk > 0) {
    cout << "NO\n";
  } else {
    cout << "YES\n";
    for (long long i = 0; i < n; ++i) {
      for (long long j = 0; j < g[i].size(); ++j) {
        cout << i + 1 << " " << g[i][j] + 1 << "\n";
      }
    }
  }
  return 0;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  return solve();
}
