#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const double eps = 1e-6;
const int MAXN = 4e5 + 10;
const int MAXM = 2e6 + 10;
vector<int> vec[MAXN];
int main() {
  int n, d, k;
  scanf("%d%d%d", &n, &d, &k);
  n--;
  int nowd = 0, id = 2;
  if (n == 1)
    nowd++;
  else if (n >= 2)
    nowd += 2;
  int maxx = 1;
  for (int i = 2; i <= k + 1 && n; i++) {
    vec[1].push_back(id++);
    n--;
  }
  int l = 2, r = k + 1;
  int temp = k * (k - 1);
  while (n) {
    if (n < k)
      nowd++;
    else
      nowd += 2;
    for (int i = l; i <= r && n; i++) {
      for (int j = 0; j < k - 1 && n; j++) {
        vec[i].push_back(id++);
        n--;
        maxx = max(maxx, i);
      }
    }
    l = r + 1, r += temp;
    temp *= (k - 1);
  }
  if (nowd > d)
    puts("NO");
  else {
    puts("YES");
    for (int i = 1; i <= maxx; i++) {
      for (int j = 0; j < vec[i].size(); j++) printf("%d %d\n", i, vec[i][j]);
    }
  }
  return 0;
}
