#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int A[N];
int l, r;
vector<pair<int, int>> sol;
int deg[N];
set<pair<int, int>> st;
int n, d, k;
int last;
void DFS(int src, int par, int rem, int con) {
  st.insert(make_pair(par, src));
  if (rem == 0) return;
  for (int i = 0; i < con && last < n; i++) {
    DFS(++last, src, rem - 1, k - 1);
  }
}
int main() {
  cin >> n >> d >> k;
  for (int i = 1; i <= d; i++) {
    if (deg[i] + 1 <= k && deg[i + 1] <= k) {
      deg[i]++, deg[i + 1]++;
      sol.push_back(make_pair(i, i + 1));
      st.insert(make_pair(i, i + 1));
    }
    last = i;
  }
  last++;
  for (int i = 2; i <= d; i++) {
    DFS(i, i - 1, min(d - i + 1, i - 1), k - 2);
  }
  if (st.size() == n - 1) {
    cout << "YES" << endl;
    for (auto i : st) {
      cout << i.first << " " << i.second << endl;
    }
  } else {
    cout << "NO" << endl;
  }
}
