#include <bits/stdc++.h>
using namespace std;
const int maxn = 5e4 + 7;
int n, d, k, cnt;
bool judge() {
  if (k & 1) {
    long long x = 1;
    for (int i = 1; i <= k / 2; i++) {
      x = x * (d - 1) + 1;
      if (x >= n) return 1;
    }
    if (n > x * 2) return 0;
    return 1;
  } else {
    long long x = 1;
    for (int i = 2; i <= k / 2; i++) {
      x = x * (d - 1) + 1;
      if (x >= n) return 1;
    }
    if (n > x * d + 1) return 0;
    return 1;
  }
}
void dfs(int h, int pre) {
  if (h == 0 || cnt == n) return;
  for (int i = 1; i <= d - 1; i++) {
    cout << pre << ' ' << ++cnt << endl;
    if (cnt == n) exit(0);
    dfs(h - 1, cnt);
    if (pre <= k && i == d - 2) break;
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> k >> d;
  if (n < k + 1) {
    cout << "NO" << endl;
    return 0;
  }
  if (judge())
    cout << "YES" << endl;
  else {
    cout << "NO" << endl;
    return 0;
  }
  for (int i = 1; i <= k; i++) cout << i << ' ' << i + 1 << endl;
  cnt = k + 1;
  for (int i = 2; i <= k; i++) dfs(min(i - 1, k + 1 - i), i);
  return 0;
}
