#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
using namespace std;
const int mxN = 4e5 + 5;
template <class T>
T gcd(T a, T b) {
  return ((b == 0) ? a : gcd(b, a % b));
}
vector<int> g[mxN];
int lev[400005], deg[mxN], bad[mxN], p[mxN];
int mx, bst;
void dfs(int cur, int prev, int dist) {
  if (dist >= mx) {
    mx = dist;
    bst = cur;
  }
  for (int x : g[cur])
    if (x != prev) {
      dfs(x, cur, dist + 1);
    }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, d, k;
  cin >> n >> d >> k;
  if (n == 1) {
    cout << "NO" << endl;
    return 0;
  }
  if (k == 1) {
    if (n == 2 && d == 1) {
      cout << "YES" << endl;
      cout << "1 2" << endl;
    } else
      cout << "NO" << endl;
    return 0;
  }
  if (d == 1) {
    if (n == 2) {
      cout << "YES" << endl;
      cout << "1 2" << endl;
    } else
      cout << "NO" << endl;
    return 0;
  }
  int num = 1;
  queue<pair<int, int> > q;
  q.push({1, 0});
  int nxt = 2;
  while (num < n) {
    pair<int, int> cur = q.front();
    q.pop();
    for (int i = 0; i < (int)(k - (cur.first != 1)); i++) {
      if (num == n) break;
      lev[cur.second + 1]++;
      g[cur.first].push_back(nxt);
      g[nxt].push_back(cur.first);
      p[nxt] = cur.first;
      deg[nxt]++, deg[cur.first]++;
      q.push({nxt, cur.second + 1});
      num++;
      nxt++;
    }
  }
  int mx = 1e9;
  for (int i = 400004; i >= 0; i--)
    if (lev[i]) {
      mx = i;
      break;
    }
  int d1 = (mx * 2) - (lev[mx] < k);
  d1 = max(d1, 2);
  if (d1 > d)
    cout << "NO" << endl;
  else {
    mx = 0;
    bst = 0;
    dfs(1, -1, 0);
    bad[bst] = 1;
    int bst1 = bst;
    bst = 0;
    mx = 0;
    dfs(bst1, -1, 0);
    bad[bst] = 1;
    queue<int> q1;
    for (int i = (int)(1); i < (int)(n + 1); i++)
      if (deg[i] == 1 && !bad[i]) q1.push(i);
    while (d1 < d) {
      if (q1.size()) {
        int nw = q1.front();
        q1.pop();
        deg[p[nw]]--;
        if (deg[p[nw]] == 1) q1.push(p[nw]);
        p[nw] = bst;
        bst = nw;
      } else {
        cout << "NO" << endl;
        return 0;
      }
      d1++;
    }
    cout << "YES" << endl;
    vector<pair<int, int> > ans;
    for (int i = (int)(2); i < (int)(n + 1); i++) ans.push_back({i, p[i]});
    for (int i = 0; i < (int)(ans.size()); i++)
      cout << ans[i].first << " " << ans[i].second << '\n';
  }
  return 0;
}
