#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long inf = 10000000;
inline bool EQ(double a, double b) { return fabs(a - b) < 1e-9; }
inline bool isLeapYear(long long year) {
  return (year % 400 == 0) || (year % 4 == 0 && year % 100 != 0);
}
inline void normal(long long &a) {
  a %= MOD;
  (a < 0) && (a += MOD);
}
inline long long modMul(long long a, long long b) {
  a %= MOD, b %= MOD;
  normal(a), normal(b);
  return (a * b) % MOD;
}
inline long long modAdd(long long a, long long b) {
  a %= MOD, b %= MOD;
  normal(a), normal(b);
  return (a + b) % MOD;
}
inline long long modSub(long long a, long long b) {
  a %= MOD, b %= MOD;
  normal(a), normal(b);
  a -= b;
  normal(a);
  return a;
}
inline long long modPow(long long b, long long p) {
  long long r = 1;
  while (p) {
    if (p & 1) r = modMul(r, b);
    b = modMul(b, b);
    p >>= 1;
  }
  return r;
}
inline long long modInverse(long long a) { return modPow(a, MOD - 2); }
inline long long modDiv(long long a, long long b) {
  return modMul(a, modInverse(b));
}
inline bool checkBit(long long n, int i) { return n & (1LL << i); }
inline long long setBit(long long n, int i) {
  return n | (1LL << i);
  ;
}
inline long long resetBit(long long n, int i) { return n & (~(1LL << i)); }
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
clock_t b = clock();
string check() {
  clock_t e = clock();
  double t = (e - b) / CLOCKS_PER_SEC;
  return !(t <= (double)1e8) ? "FUCK" : "YAAAH";
}
void input(long long n, const long long a[], int co = 0) {
  long long i = 1;
  for (; i <= n; i++) {
    if (co == 0)
      scanf("%lld", &a[i]);
    else
      printf("%lld ", a[i]);
  }
}
void dfs() {}
bool cmp() {}
void solve() {}
vector<int> g[400009];
int n, d, k;
int ctx;
void ndfs(int ind, int lvl, int deg) {
  int i;
  if (lvl == 0 || ctx >= n) return;
  for (i = 0; i < deg; i++) {
    g[ind].push_back(ctx);
    g[ctx].push_back(ind);
    ctx++;
    ndfs(ctx, lvl - 1, k - 1);
    if (ctx >= n) return;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> d >> k;
  int i, j;
  if (k == 1 && (n != 2 || d != 1)) {
    cout << "NO";
    return 0;
  }
  for (i = 0; i < d; i++) {
    g[i].push_back(i + 1);
    g[i + 1].push_back(i);
  }
  ctx = d + 1;
  for (i = 1; i <= (d - 1) / 2; i++) {
    ndfs(i, i, k - 2);
    ndfs(d - i, i, k - 2);
  }
  if (d % 2 == 0) ndfs(d / 2, d / 2, k - 2);
  if (ctx != n) {
    cout << "NO";
    return 0;
  } else {
    cout << "YES\n";
    for (i = 0; i < n; i++) {
      for (auto it = g[i].begin(); it != g[i].end(); it++) {
        if ((*it) > i) cout << i + 1 << " " << (*it) + 1 << endl;
      }
    }
  }
  return 0;
}
