import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author kessido
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ETreeConstructing solver = new ETreeConstructing();
        solver.solve(1, in, out);
        out.close();
    }

    static class ETreeConstructing {
        ArrayList<Node> nodes = new ArrayList<>();
        int indCount = 1;
        int maxDist = 0;
        int neededSize;
        int k;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.NextInt();
            int d = in.NextInt();
            k = in.NextInt();
            maxDist = d / 2;
            neededSize = n;
            Node root = new Node();
            root.makeSureOfPath(0);
            if (maxDist * 2 != d) {
                root.makeSureOfPath(-1);
            } else {
                root.makeSureOfPath(0);
            }
            for (int i = 0; i < nodes.size(); i++) {
                Node node = nodes.get(i);
                if (node.rank > k) {
                    out.println("NO");
                    return;
                }
                node.fill();
                if (nodes.size() > neededSize) break;
            }
            if (nodes.size() < neededSize || nodes.size() > neededSize) {
                out.println("NO");
            } else {
                out.println("YES");
                for (Node node : nodes) {
                    if (node.par != null) {
                        out.println(node.index + " " + node.par.index);
                    }
                }
            }
        }

        class Node {
            Node par;
            int rank;
            int dist;
            int index;

            Node() {
                this.index = indCount++;
                nodes.add(this);
            }

            Node(Node par) {
                this();
                this.par = par;
                dist = par.dist + 1;
            }

            void makeSureOfPath(int shift) {
                if (dist == maxDist) return;
                Node cur = new Node();
                rank++;
                cur.par = this;
                cur.dist = dist + 1 + shift;
                cur.rank = 1;
                while (cur.dist != maxDist) {
                    cur.rank++;
                    cur = new Node(cur);
                    cur.rank++;
                }
            }

            void fill() {
                if (dist == maxDist) return;
                for (; rank < k; rank++) {
                    if (neededSize == nodes.size()) return;
                    new Node(this).rank = 1;
                }
            }

        }

    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine(), " \t\n\r\f,");
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int NextInt() {
            return Integer.parseInt(next());
        }

    }
}

