#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > ans;
int d;
int n, td, k;
void dfs(int x, int dep, int maxd) {
  if (dep == maxd) return;
  for (int i = 0; i < k - 1 - (dep == 0) && d < n; ++i) {
    ans.push_back(make_pair(x, ++d));
    dfs(d, dep + 1, maxd);
  }
}
int main() {
  scanf("%d%d%d", &n, &td, &k);
  if (td > 1 && k == 1) {
    printf("NO\n");
    return 0;
  }
  if (n <= td) {
    printf("NO\n");
    return 0;
  }
  for (int i = 1; i <= td; ++i) {
    ans.push_back(make_pair(i, i + 1));
  }
  d = td + 1;
  for (int i = 2; i <= td; ++i) dfs(i, 0, min(i - 1, td - i + 1));
  if (d < n) {
    printf("NO\n");
    return 0;
  }
  printf("YES\n");
  for (int i = 0; i < ans.size(); ++i) {
    printf("%d %d\n", ans[i].first, ans[i].second);
  }
}
