#include <bits/stdc++.h>
using namespace std;
const int maxn = 400100;
int n, d, k, cnt = 0;
int eu[maxn], ev[maxn], tot = 0;
void dfs(int u, int dep, int fa, int d) {
  if (cnt > n) return;
  eu[++tot] = fa;
  ev[tot] = u;
  if (dep == d) return;
  for (int i = 2; i <= k; i++) dfs(++cnt, dep + 1, u, d);
}
int main() {
  scanf("%d%d%d", &n, &d, &k);
  if (n <= d) {
    puts("NO");
    return 0;
  }
  cnt = d + 1;
  for (int i = 2; i <= d + 1; i++) eu[++tot] = i - 1, ev[tot] = i;
  for (int i = 2; i <= d + 1; i++) {
    int dd = min(i - 1, d - i + 1);
    for (int j = 1; j < k; j++) dfs(++cnt, 1, i, dd);
  }
  if (cnt >= n) {
    puts("YES");
    for (int i = 1; i <= tot; i++) printf("%d %d\n", eu[i], ev[i]);
  } else
    puts("NO");
  return 0;
}
