#include <bits/stdc++.h>
using namespace std;
const int N_MAX = 4e5;
int n;
vector<int> gr[N_MAX + 2];
int depth[N_MAX + 2];
int last, maxDepth;
void dfs(int node, int daddy) {
  if (depth[node] > maxDepth) {
    maxDepth = depth[node];
    last = node;
  }
  for (unsigned i = 0; i < gr[node].size(); i++) {
    int it = gr[node][i];
    if (it != daddy) {
      depth[it] = depth[node] + 1;
      dfs(it, node);
    }
  }
}
struct ura {
  int x;
  int y;
};
ura sol[N_MAX + 1];
int q[N_MAX + 1];
int main() {
  int n, d, k, vf, w, nr, nsol, i;
  cin >> n >> d >> k;
  vf = 1;
  w = 1;
  q[w] = 1;
  nr = 2;
  nsol = 0;
  while (w <= vf && nr <= n) {
    for (i = 1; i <= k && nr <= n; i++) {
      gr[q[w]].push_back(nr);
      gr[nr].push_back(q[w]);
      sol[++nsol].x = q[w];
      sol[nsol].y = nr;
      if (w != 1 || nr == 2) q[++vf] = nr;
      nr++;
    }
    w++;
  }
  dfs(1, 0);
  depth[last] = 1;
  dfs(last, 0);
  if (maxDepth - 1 <= d) {
    cout << "YES\n";
    for (i = 1; i <= nsol; i++) cout << sol[i].x << ' ' << sol[i].y << '\n';
  } else {
    cout << "NO";
  }
  return 0;
}
