#include <bits/stdc++.h>
using namespace std;
void func(void) {
  freopen("input.c", "r", stdin);
  freopen("output.c", "w", stdout);
}
void print(vector<long long> &v) {
  cout << v.size() << endl;
  for (int i = 0; i < v.size(); i++) {
    printf("%lld ", v[i]);
  }
  printf("\n");
}
void print(vector<pair<long long, long long> > &v) {
  for (int i = 0; i < v.size(); i++) {
    printf("%lld %lld\n", v[i].first, v[i].second);
  }
}
void print(double d) { cout << fixed << setprecision(10) << d << endl; }
void print(string s, double d) {
  cout << s << " ";
  cout << fixed << setprecision(10) << d << endl;
}
vector<pair<long long, long long> > v;
const int N = 5e5;
int vis[N];
int dis[N];
int high;
int highest;
void dfs(int x, int posOrNeg, int d) {
  dis[x] = max(dis[x], d);
  if (posOrNeg and x == high) {
    return;
  }
  if (!posOrNeg and x == 1) {
    return;
  }
  if (posOrNeg)
    dfs(x + 1, posOrNeg, d + 1);
  else
    dfs(x - 1, posOrNeg, d + 1);
}
int cc;
long long rem;
void againDfs(int x, int degree, int d) {
  if (x == high) return;
  for (int i = 0; i < degree and rem; i++) {
    if (dis[x] + 1 > highest) break;
    dis[cc++] = dis[x] + 1;
    v.push_back({x, cc - 1});
    rem--;
    againDfs(cc - 1, degree + 1, d + 1);
  }
  if (x < high and rem) {
    againDfs(x + 1, degree, dis[x + 1]);
  }
}
int main() {
  long long n, q, i, j = 0, temp, t, k, ans = 0, sum = 0, x, y, z, cnt = 0, m,
                     fg = 0, mx = 0, mx1 = 0, mn = 8000000000000000000,
                     mn1 = 8000000000000000000;
  scanf("%lld %lld %lld", &n, &m, &k);
  if (n == 1) {
    cout << "NO\n";
    return 0;
  }
  if (n == 2) {
    if (m > 1) {
      cout << "NO\n";
      return 0;
    }
    cout << "YES\n";
    cout << "1 2\n";
    return 0;
  }
  if (n == 3) {
    if (m == 2 and k >= 2) {
      cout << "YES\n";
      cout << "1 2\n1 3\n";
      return 0;
    }
    cout << "NO\n";
    return 0;
  }
  if (m >= n or k < 2) {
    cout << "NO\n";
    return 0;
  }
  rem = n - (m + 1);
  for (int i = 1; i <= m; i++) {
    v.push_back({i, i + 1});
  }
  highest = m;
  high = m + 1;
  cc = m + 2;
  dfs(1, 1, 0);
  dfs(high, 0, 0);
  againDfs(2, k - 2, dis[2]);
  if (rem) {
    cout << "NO\n";
    return 0;
  }
  cout << "YES\n";
  print(v);
}
