#include <bits/stdc++.h>
using namespace std;
const int maxn = 100 + 10;
const int INF = 0x3f3f3f3f;
vector<int> G[400005];
int main() {
  int n, k, d;
  cin >> n >> d >> k;
  int tk = k;
  int temp = k, t = k - 1;
  for (int i = 2; i <= d - 1; i++) {
    t *= (k - 1);
    temp += t;
  }
  if (d > n - 1 || temp < n - 1) {
    cout << "NO" << endl;
    return 0;
  }
  cout << "YES" << endl;
  int s = n - 1, now = 1, cur = 1;
  int pre = 1;
  for (int i = 1; i < d; i++) {
    cur++;
    if (i > 1) k = tk - 1;
    int t = (int)pow(k, i);
    if (s - t >= d - cur) {
      s -= t;
      int tt = pre, nn = 0;
      for (int j = pre + 1; j <= pre + t; j++) {
        nn++;
        G[tt].push_back(j);
        if (nn == k) tt++;
      }
      if (i > 1)
        pre += t;
      else
        pre++;
    } else {
      int dd = s - d + cur;
      int tt = pre, nn = 0;
      for (int j = pre + 1; j <= pre + dd; j++) {
        G[tt].push_back(j);
        nn++;
        if (nn == k) tt++;
      }
      s = d - cur;
      if (i > 1)
        pre += dd;
      else
        pre++;
      while (s--) {
        G[pre].push_back(pre + 1);
        pre++;
      }
      break;
    }
  }
  for (int i = 1; i <= n; i++) {
    if (G[i].size() != 0) {
      for (int j = 0; j < G[i].size(); j++) cout << i << " " << G[i][j] << endl;
    }
  }
}
