#include <bits/stdc++.h>
using namespace std;
vector<int> v1, v2;
int temp, n, d, k, x;
int r[40005];
void dfs(int root, int dd) {
  if (r[root] >= k || dd >= d - 1 || temp > n) return;
  for (int i = 1; i <= k - 1; i++) {
    if (dd == 1) {
      i++;
    }
    if (temp > n) {
      return;
    }
    v1.push_back(root);
    v2.push_back(temp);
    r[root]++;
    r[temp]++;
    int t = temp;
    temp++;
    for (int j = 1; j < k; j++) {
      dfs(t, dd + 1);
    }
  }
  return;
}
int main() {
  memset(r, 0, sizeof(r));
  scanf("%d%d%d", &n, &d, &k);
  if (n == 1 || d >= n) {
    printf("NO\n");
  } else {
    temp = 1;
    for (int i = 1; i <= d; i++) {
      v1.push_back(temp++);
      v2.push_back(temp);
      r[temp]++;
      r[temp - 1]++;
    }
    temp++;
    for (int i = 2; i <= d; i++) {
      dfs(i, 1);
      if (temp > n) {
        break;
      }
    }
    if (temp != n + 1) {
      printf("NO\n");
    } else {
      printf("YES\n");
      for (int i = 0; i < n - 1; i++) {
        printf("%d %d\n", v1[i], v2[i]);
      }
    }
  }
  return 0;
}
