#include <bits/stdc++.h>
using namespace std;
int n, d, k, Node[400005], NId = 1;
vector<pair<int, int> > V;
bool p = true;
bool Tree(int node, int depth) {
  if (depth > d) {
    if (p) {
      p = false;
      d--;
    }
    return false;
  }
  for (int i = (node != 0); i < k; i++) {
    if (NId >= n) return true;
    V.push_back({node, NId});
    if (Tree(NId++, depth + 1)) return true;
  }
  if (NId >= n) return true;
  return false;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> d >> k;
  p = (d & 1);
  d = d >> 1;
  if (p == false) d--;
  if (Tree(0, 0)) {
    cout << "YES\n";
    n = V.size();
    for (int i = 0; i < n; i++) {
      cout << V[i].first + 1 << " " << V[i].second + 1 << endl;
    }
  } else
    cout << "NO\n";
  return 0;
}
