#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 400 * 1000 + 19;
const int inf = 2e9 + 19;
int n, d, k, deg[MAX_N];
vector<int> ff[MAX_N];
vector<pair<int, int> > ans;
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n >> d >> k;
  int f = ((d + 1) / 2) + 1;
  if (d & 1) {
    if (n < 2 * f - 2) return cout << "NO", 0;
  } else {
    if (n < 2 * f - 1) return cout << "NO", 0;
  }
  int tmp = 1;
  ff[0].push_back(0);
  while (tmp < n) {
    for (int i = 1; i < f; i++) {
      if ((int)ff[i].size() == ((int)ff[i - 1].size() * k)) continue;
      ff[i].push_back(tmp);
      tmp++;
      if (tmp == n) break;
    }
    int cnt = 0;
    for (int i = 1; i < f; i++)
      if ((int)ff[i].size() >= k * ((int)ff[i - 1].size())) cnt++;
    if (cnt == f - 1 && tmp < n) return cout << "NO", 0;
  }
  bool flag = true;
  if (d & 1) {
    for (int i = 0; i < f - 2; i++) {
      int x = 0, y = 0;
      while (y < (int)ff[i + 1].size()) {
        ans.push_back({ff[i][x] + 1, ff[i + 1][y] + 1});
        deg[ff[i][x]]++, deg[ff[i + 1][y]]++;
        if (deg[ff[i][x]] > k || deg[ff[i + 1][y]] > k) {
          flag = false;
          return cout << "NO", 0;
        }
        x++, y++;
        if (x == (int)ff[i].size()) x = 0;
      }
    }
    int t = ff[f - 2][0];
    for (int i = 0; i < (int)ff[f - 1].size(); i++) {
      ans.push_back({t + 1, ff[f - 1][i] + 1});
      deg[t]++, deg[ff[f - 1][i]]++;
      if (deg[t] > k || deg[ff[f - 1][i]] > k) {
        flag = false;
        return cout << "NO", 0;
      }
    }
  } else {
    for (int i = 0; i < f - 1; i++) {
      int x = 0, y = 0;
      while (y < (int)ff[i + 1].size()) {
        ans.push_back({ff[i][x] + 1, ff[i + 1][y] + 1});
        deg[ff[i][x]]++, deg[ff[i + 1][y]]++;
        if (deg[ff[i][x]] > k || deg[ff[i + 1][y]] > k) {
          flag = false;
          return cout << "NO", 0;
        }
        x++, y++;
        if (x == (int)ff[i].size()) x = 0;
      }
      if (!flag) break;
    }
  }
  if (!flag)
    return cout << "NO", 0;
  else {
    cout << "YES" << endl;
    for (auto i : ans) cout << i.first << ' ' << i.second << endl;
  }
  return (0);
}
