#include <bits/stdc++.h>
#pragma optimize("Ofast")
using namespace std;
bool Finish_read;
template <class T>
inline void read(T &x) {
  Finish_read = 0;
  x = 0;
  int f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    if (ch == EOF) return;
    ch = getchar();
  }
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  x *= f;
  Finish_read = 1;
}
template <class T>
inline void print(T x) {
  if (x / 10 != 0) print(x / 10);
  putchar(x % 10 + '0');
}
template <class T>
inline void writeln(T x) {
  if (x < 0) putchar('-');
  x = abs(x);
  print(x);
  putchar('\n');
}
template <class T>
inline void write(T x) {
  if (x < 0) putchar('-');
  x = abs(x);
  print(x);
  putchar(' ');
}
vector<pair<int, int> > ans;
void print() {
  printf("YES\n");
  for (int i = 0; i < (int)ans.size(); i++)
    printf("%d %d\n", ans[i].first, ans[i].second);
}
void check(int left, int last) {
  for (int i = 1; i <= left; i++) {
    pair<int, int> tmp;
    tmp.first = last++;
    tmp.second = last;
    ans.push_back(tmp);
  }
}
int main() {
  int n, d, k;
  scanf("%d%d%d", &n, &d, &k);
  if (d == 1) {
    if (n == 2)
      printf("YES\n1 2\n");
    else
      printf("NO\n");
    return 0;
  }
  if (n == 1 || d >= n) {
    printf("NO\n");
    return 0;
  }
  if (k == 1) {
    if (d == 1 && n == 2)
      printf("YES\n1 2\n");
    else
      printf("NO\n");
    return 0;
  }
  if (k == 2) {
    if (d == n - 1) {
      printf("YES\n");
      for (int i = 1; i < n; i++) printf("%d %d\n", i, i + 1);
    } else
      printf("NO\n");
    return 0;
  }
  int now = 2;
  for (int i = 1; i <= 2; i++) {
    pair<int, int> tmp;
    tmp.first = 1;
    tmp.second = now++;
    ans.push_back(tmp);
    d--;
    if (n - now + 1 == d) {
      check(d, now - 1);
      print();
      return 0;
    }
    if (now > n) {
      print();
      return 0;
    }
  }
  for (int i = 3; i <= k; i++) {
    pair<int, int> tmp;
    tmp.first = 1;
    tmp.second = now++;
    ans.push_back(tmp);
    if (n - now + 1 == d) {
      check(d, now - 1);
      print();
      return 0;
    }
    if (now > n) {
      print();
      return 0;
    }
  }
  int nows = 2;
  long long nowd = k;
  while (1) {
    if (!d) {
      printf("NO\n");
      return 0;
    }
    d--;
    for (int i = 1; i < k; i++) {
      pair<int, int> tmp;
      tmp.first = nows;
      tmp.second = now++;
      ans.push_back(tmp);
      if (n - now + 1 == d) {
        check(d, now - 1);
        print();
        return 0;
      }
      if (now > n) {
        print();
        return 0;
      }
    }
    if (nowd != k) {
      for (int j = 1; j < nowd / k; j++) {
        nows++;
        for (int i = 1; i < k; i++) {
          pair<int, int> tmp;
          tmp.first = nows;
          tmp.second = now++;
          ans.push_back(tmp);
          if (n - now + 1 == d) {
            check(d, now - 1);
            print();
            return 0;
          }
          if (now > n) {
            print();
            return 0;
          }
        }
      }
    }
    if (!d) {
      printf("NO\n");
      return 0;
    }
    d--;
    for (int i = 1; i < nowd; i++) {
      nows++;
      for (int j = 1; j < k; j++) {
        pair<int, int> tmp;
        tmp.first = nows;
        tmp.second = now++;
        ans.push_back(tmp);
        if (n - now + 1 == d) {
          check(d, now - 1);
          print();
          return 0;
        }
        if (now > n) {
          print();
          return 0;
        }
      }
    }
    nowd *= (k - 1);
    nows++;
  }
  printf("NO\n");
  return 0;
}
