#include <bits/stdc++.h>
using namespace std;
int f[400005];
int ans[400005][2];
int main() {
  memset(f, 0, sizeof(f));
  queue<int> q;
  int n, d, k;
  cin >> n >> d >> k;
  int s = 0;
  int h = 0;
  for (int i = 1; i < n; i++) {
    ans[h][0] = i, ans[h][1] = i + 1;
    h++;
    s++;
    if (s == d) {
      break;
    }
  }
  if (s < d) {
    cout << "NO" << endl;
    return 0;
  }
  if (h == n - 1) {
    cout << "YES" << endl;
    for (int i = 0; i < h; i++) {
      cout << ans[i][0] << " " << ans[i][1] << endl;
    }
    return 0;
  }
  for (int i = 1; i <= d / 2 + 1; i++) {
    f[i] = i - 1;
    f[d + 2 - i] = i - 1;
  }
  int b = d + 2;
  for (int i = 2; i <= d; i++) {
    q.push(i);
    while (!q.empty()) {
      int x = q.front();
      q.pop();
      if (x <= d && f[x] > 0) {
        for (int j = 1; j < k - 1; j++) {
          ans[h][0] = x, ans[h][1] = b;
          f[b] = f[x] - 1;
          q.push(b);
          h++;
          b++;
          if (h == n - 1) {
            break;
          }
        }
      } else if (f[x] > 0) {
        for (int j = 1; j < k; j++) {
          ans[h][0] = x, ans[h][1] = b;
          f[b] = f[x] - 1;
          q.push(b);
          h++;
          b++;
          if (h == n - 1) {
            break;
          }
        }
      }
      if (h == n - 1) {
        break;
      }
    }
    if (h == n - 1) {
      cout << "YES" << endl;
      for (int i = 0; i < h; i++) {
        cout << ans[i][0] << " " << ans[i][1] << endl;
      }
      return 0;
    }
  }
  for (int i = 0; i < h; i++) {
    cout << ans[i][0] << " " << ans[i][1] << endl;
  }
  if (h < n - 1) {
    cout << "NO" << endl;
    return 0;
  }
  return 0;
}
