#include <bits/stdc++.h>
using namespace std;
const int maxN = (int)4e5, maxM = (int)1e2, intMax = INT_MAX, maxValue = 44721,
          mod = (int)1e9 + 7;
const long long llmax = LLONG_MAX, INF = (long long)1e9 + 1;
long long nod(long long a, long long b) {
  while (a != 0 && b != 0) {
    if (a < b)
      b %= a;
    else
      a %= b;
  }
  return a + b;
}
int nod(int a, int b) {
  while (a != 0 && b != 0) {
    if (a < b)
      b %= a;
    else
      a %= b;
  }
  return a + b;
}
long long nok(long long a, long long b) { return a * b / nod(a, b); }
int nok(int a, int b) { return a * b / nod(a, b); }
long long modPlus(long long a, long long b) {
  a %= mod;
  b %= mod;
  return a + b;
}
int modPlus(int a, int b) {
  a %= mod;
  b %= mod;
  return a + b;
}
int n, d, k;
int Q[maxN];
vector<int> graph[maxN];
int get(int act, int h) {
  if (h == d) return act;
  if (n == 0) return act;
  int q = act;
  for (int i = 1; i < k && n; ++i) {
    graph[q - 1].push_back(act);
    n--;
    act = get(act + 1, h + 1);
  }
  return act;
}
void printG(int v, int p) {
  for (auto i : graph[v]) {
    if (i != p) {
      printf("%d %d\n", v + 1, i + 1);
      printG(i, v);
    }
  }
}
int main() {
  scanf("%d%d%d", &n, &d, &k);
  if (k == 1 && n == 2) {
    printf("YES\n");
    printf("%d %d\n", 1, 2);
    return 0;
  }
  if (k == 2 && d == n - 1) {
    printf("YES\n");
    for (int i = 1; i < n; i++) printf("%d %d\n", i, i + 1);
    return 0;
  }
  if (k == 2) {
    printf("NO");
    return 0;
  }
  if (n == 1) {
    return 0;
  }
  n--;
  for (int i = 1; i <= d && n; i++) {
    graph[i - 1].push_back(i);
    n--;
  }
  int act = d + 1;
  for (int i = 2; i <= d && n; i++) {
    for (int j = 0; j < k - 2 && n; j++) {
      graph[i - 1].push_back(act);
      n--;
      act = get(act + 1, max(i, d - i + 2));
    }
  }
  if (!n) {
    printf("YES\n");
    printG(0, -1);
  } else
    printf("NO");
  return 0;
}
