#include <bits/stdc++.h>
using namespace std;
long long n, d, k, nodes, lastnode, maxh = 0, harr[4 * 100010], maxnodes = 0;
vector<long long> edge[4 * 100010];
queue<long long> Q;
void bfs(long long pos, long long mark, long long height) {
  long long i, lim = (pos == 1 ? lim = k : lim = k - 1);
  Q.push(pos);
  while (!Q.empty() && nodes > 0) {
    for (i = 0; i < lim && nodes > 0; i++) {
      edge[pos].push_back(mark + i);
      Q.push(mark + i);
      nodes--;
      harr[mark + i] = height + 1;
      if (harr[mark + i] > maxh) {
        maxh = harr[mark + i];
        lastnode = mark + i;
      }
    }
    if (!Q.empty()) Q.pop();
    if (!Q.empty()) bfs(Q.front(), mark + i, harr[Q.front()]);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> d >> k;
  nodes = n - 1;
  if (d % 2 == 0)
    maxnodes =
        1 + k + ((k) * (k - 1) * ((pow(k - 1, d / 2 + 1 - 2) - 1) / (k - 2)));
  else
    maxnodes = maxnodes =
        1 + k + ((k) * (k - 1) * ((pow(k - 1, d / 2 + 1 - 2) - 1) / (k - 2))) +
        k;
  if (maxnodes < n) {
    cout << "NO\n";
    return 0;
  }
  cout << "YES\n";
  maxh = 1;
  harr[1] = 1;
  bfs(1, 2, 1);
  long long i;
  for (i = 1; i <= n; i++)
    for (int j = 0; j < edge[i].size(); j++)
      cout << i << " " << edge[i][j] << endl;
  return 0;
}
