#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, d, k;
  cin >> n >> d >> k;
  vector<vector<int>> tree(n + 1);
  int length = n / d;
  if (length + 1 > d) {
    cout << "NO" << endl;
    return 0;
  }
  int total = 1;
  int addin = 2;
  int current_node = 1;
  while (total < n) {
    for (int i = 0; i < k; i++) {
      tree[current_node].push_back(addin);
      addin += 1;
      total += 1;
      if (total >= n) {
        break;
      }
    }
    current_node += 1;
  }
  for (int i = 1; i <= n; i++) {
    if (tree[i].size() > 0) {
      for (int j = 0; j < tree[i].size(); j++) {
        cout << i << " " << tree[i][j] << endl;
      }
    } else {
      break;
    }
  }
}
