#include <bits/stdc++.h>
using namespace std;
void add_edge(vector<vector<int> >& v, int x, int y) {
  v[x].push_back(y);
  v[y].push_back(x);
  return;
}
int main() {
  int n, d, k;
  cin >> n >> d >> k;
  int height = ceil((1.0 * d) / 2);
  vector<vector<int> > v;
  vector<int> empty_vec;
  for (int i = 0; i <= n; i++) v.push_back(empty_vec);
  if (k == 1 || d > n - 1) {
    cout << "NO" << endl;
  } else {
    int root = 1;
    int last_used_vertex = 1;
    int curr_vertex = 1;
    for (int i = 0; i < d; i++) {
      if (i == height) curr_vertex = 1;
      last_used_vertex++;
      add_edge(v, curr_vertex, last_used_vertex);
      curr_vertex = last_used_vertex;
    }
    queue<pair<int, int> > q;
    int root_depth;
    q.push(make_pair(root, 0));
    q.push(make_pair(v[root][0], 1));
    if (d % 2 == 1) {
      root_depth = 1;
      q.push(make_pair(v[root][1], 2));
    } else {
      root_depth = 0;
      q.push(make_pair(v[root][1], 1));
    }
    while (!q.empty()) {
      pair<int, int> p = q.front();
      int vertex = p.first;
      int depth = p.second;
      bool flag = false;
      q.pop();
      if (depth == height) continue;
      int vertices_to_add = k - v[vertex].size();
      if (vertex != root) {
        for (int i = 0; i < v[vertex].size(); i++) {
          if (v[vertex][i] > vertex) q.push(make_pair(v[vertex][i], depth + 1));
        }
      }
      if (vertex == root) depth = root_depth;
      for (int j = 0; j < vertices_to_add; j++) {
        if (last_used_vertex == n) {
          flag = true;
          break;
        }
        last_used_vertex++;
        add_edge(v, vertex, last_used_vertex);
        q.push(make_pair(last_used_vertex, depth + 1));
      }
      if (flag) break;
    }
    if (last_used_vertex < n)
      cout << "NO" << endl;
    else {
      cout << "YES" << endl;
      for (int i = 1; i <= n; i++) {
        for (int j = 0; j < v[i].size(); j++) {
          if (i < v[i][j]) cout << i << " " << v[i][j] << endl;
        }
      }
    }
  }
}
