#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fin(s) freopen(s, "r", stdin);
#define fout(s) freopen(s, "w", stdout);
#define un unsigned int
#define ull unsigned long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pk pop_back
#define pf push_front
#define pt pop_front
int main() {
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
//    fin("input.txt")
//    fout("output.txt")
    int n, k, d;
    cin >> n >> d >> k;
    deque < int > D;
    int edges[n + 10] = {0};
    D.pb(1);
    int y = 2;
    int deep[n + 10] = {0};
    deep[1] = 1;
    if (d > n) {
        cout << -1;
        return 0;
    }
    vector < pair < int , int > > ans;
    for (int i = 1; i < d; ++i) {
        ans.pb({i, i + 1});
        edges[i]++;
        edges[i + 1]++;
        deep[i + 1] = deep[i] + 1;
        D.pb(i);
    }
    D.pb(d);
    y = d + 1;
    while (!D.empty() && y <= n) {
        int x = D.front();
        D.pt();
        if (deep[x] == d)
            continue;
        while (edges[x] < k && y <= n) {
            deep[y] = deep[x] + 1;
            edges[x]++;
            edges[y]++;
            ans.pb({x, y});
            D.pb(y);
            ++y;
        }
    }
    if (y != n + 1) {
        cout << "NO\n";
        return 0;
    }
    cout << "YES\n";
    for (auto i: ans)
        cout << i.fi << ' ' << i.se << '\n';
    return 0;
}

