#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;
    ++d;
    deque < int > D;
    int edges[n + 10] = {0};
    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]++;
        D.pb(i);
    }
//    cout << d << '\n';
    D.pb(d);
    int y = d + 1;
    map < int , int > deep;
//    cout << D.size() << '\n';
    for (int i = 0; i < D.size(); ++i) {
        if (y == n + 1)
            break;
        int x = d - max(i + 1, (int) D.size() - i);
        deque < int > v;
//        cout << "i = " << i << "x = " << x << '\n';
        v.pb(D[i]);
        while (!v.empty() && y <= n) {
            int fr = v.front();
            v.pt();
            if (deep[fr] == x)
                continue;
            while (edges[fr] < k && y <= n) {
                deep[y] = deep[fr] + 1;
                edges[fr]++;
                edges[y]++;
                v.pb(y);
                ans.pb({fr, 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;
}

