#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 4e5 + 9;
int vec[MAX_N];
int deep[MAX_N];
int dis[MAX_N];
int N, M, T, S;
int sy(int x) {
  int t = S;
  int ans = 1;
  ans += S;
  for (int i = 2; i <= x; i++) {
    t *= (S - 1);
    ans += t;
    if (ans > MAX_N) break;
  }
  return ans;
}
int my_pow(int k, int n) {
  int ans = 1;
  for (int i = 0; i < n; i++) {
    ans *= k;
    if (ans > MAX_N) break;
  }
  return ans;
}
int main() {
  while (cin >> N >> M >> S) {
    if (M + 1 > N)
      cout << "NO" << endl;
    else if (M % 2 == 1 &&
             (long long)sy(M / 2) + (S - 1) * (my_pow(S - 1, M / 2 - 1)) < N) {
      cout << "NO" << endl;
    } else if (M % 2 == 0 && sy(M / 2) < N) {
      cout << "NO" << endl;
    } else {
      cout << "YES" << endl;
      memset(vec, 0, sizeof(vec));
      memset(dis, 0, sizeof(dis));
      queue<int> que;
      for (int i = 2; i <= M + 1; i++) {
        printf("%d %d\n", i - 1, i);
        deep[i] = abs(M / 2 + 1 - i);
        if (i != M + 1) que.push(i), vec[i] = 1;
      }
      for (int i = 1; i <= M; i++) vec[i] += 1;
      for (int i = M / 2 + 2; i < M + 1; i++) dis[i] = 1;
      deep[0] = M / 2 + 1;
      int t = que.front();
      que.pop();
      for (int i = M + 2; i <= N; i++) {
        printf("%d %d\n", t, i);
        deep[i] = deep[t] + 1;
        if (deep[i] < M / 2)
          que.push(i);
        else if (dis[t] == 1) {
          que.push(i);
          deep[i] = deep[t];
        }
        vec[i] = 1;
        vec[t]++;
        if (vec[t] == S) {
          t = que.front();
          que.pop();
        }
      }
    }
  }
}
