#include <bits/stdc++.h>
using namespace std;
inline bool equal(double _x, double _y) {
  return _x > _y - 1e-9 && _x < _y + 1e-9;
}
int n, d, k, cur;
vector<int> v[400005];
void dfs(int x, int dp, int pa, int md) {
  v[pa].push_back(x);
  if (md == dp) return;
  for (int i = 1; i < k && cur < n; i++) dfs(++cur, dp + 1, x, md);
}
int main() {
  scanf("%d%d%d", &n, &d, &k);
  if (n <= d) {
    puts("NO");
    return 0;
  }
  for (cur = 1; cur <= d; cur++) v[cur].push_back(cur + 1);
  for (int i = 2; i <= d && cur < n; i++)
    for (int j = 0; j < k - 2 && cur < n; j++)
      dfs(++cur, 1, i, min(i - 1, d + 1 - i));
  if (cur < n)
    puts("NO");
  else {
    puts("YES");
    for (int i = 1; i <= n; i++)
      for (auto j : v[i]) printf("%d %d\n", i, j);
  }
}
