#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const long long inf = 1e10;
ll n, m, k;
vector<int> adj[400001];
int dp[400001];
int rt, lt;
int cnt = 1;
bool dfs1(int u, int dep) {
  dp[u] = dep;
  cnt++;
  if (dep == m) {
    lt = u;
    return 1;
  }
  if (cnt == n + 1) {
    return 0;
  }
  adj[u].push_back(cnt);
  return dfs1(cnt, dep + 1);
}
void dfs2(int u, int left) {
  if (!left) return;
  if (cnt == n + 1) return;
  while (cnt <= n && adj[u].size() < k - 1) {
    adj[u].push_back(cnt);
    cnt++;
    dfs2(cnt - 1, left - 1);
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> k;
  rt = 1;
  if (!dfs1(rt, 0)) {
    cout << "NO"
         << "\n";
    return 0;
  }
  int nnodes = cnt;
  for (int i = 2; i < nnodes; i++) {
    dfs2(i, min(dp[i], (int)m - dp[i]));
  }
  if (cnt == n + 1) {
    cout << "YES"
         << "\n";
    for (int i = 1; i < n + 1; i++) {
      for (auto x : adj[i]) {
        cout << i << " " << x << "\n";
      }
    }
    return 0;
  }
  cout << "NO"
       << "\n";
  return 0;
}
