#include <bits/stdc++.h>
using namespace std;
const int N = 1e6;
struct node {
  int x, y;
} e[N];
int n, d, k, now = 0, len = 0;
void read(int x, int y) { e[++len].x = x, e[len].y = y; }
void dfs(int x, int deep, int maxn) {
  if (deep == maxn) return;
  for (int i = 1; i <= k - 1 - (deep == 0) && now < n; i++) {
    read(x, ++now);
    dfs(now, deep + 1, maxn);
  }
}
int main() {
  scanf("%d%d%d", &n, &d, &k);
  for (int i = (1); i <= (d); i++) read(i, i + 1);
  now = d + 1;
  for (int i = (2); i <= (d); i++) dfs(i, 0, min(i - 1, d - i + 1));
  if (now < n || k < 2 && d > 1 || n <= d) {
    cout << "NO\n";
    return 0;
  }
  cout << "YES\n";
  for (int i = (1); i <= (len); i++) printf("%d %d\n", e[i].x, e[i].y);
  return 0;
}
