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

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
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);
        TaskE solver = new TaskE();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskE {
        int n;
        int d;
        int k;
        List<Pair> edge = new ArrayList<>();
        Map<Integer, Vertex> mapping = new HashMap<>();

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            n = in.nextInt();
            d = in.nextInt();
            k = in.nextInt();
            if (!canBuild()) {
                out.println("NO");
                return;
            }
            for (int i = 0; i < n; ++i) {
                mapping.put(i, new Vertex(i));
            }
            for (int i = 0; i < d; ++i) {
                edge.add(new Pair(i, i + 1));
                mapping.get(i).edgeCount++;
                mapping.get(i + 1).edgeCount++;
            }
            int cur = d + 1;
            int depth = 1;
            for (int i = 1; i <= d - 1; ++i) {
                cur = mapping.get(i).connect(cur, 0, depth);
                if (d % 2 == 1) {
                    if (i < d / 2) {
                        ++depth;
                    } else {
                        --depth;
                    }
                } else {
                    if (i < d / 2) {
                        ++depth;
                    } else if (i > d / 2) {
                        --depth;
                    }
                }
            }
            out.println("YES");
            for (int i = 0; i < edge.size(); ++i) {
                Pair e = edge.get(i);
                out.println((e.first + 1) + " " + (e.second + 1));
            }
        }

        private boolean canBuild() {
            if (d >= n) {
                return false;
            }
            int count = d + 1;
            int rem = d - 1;
            if (rem % 2 == 1) {
                int pow = (k - 1);
                for (int i = 0; i <= rem / 2; ++i) {
                    count += (k - 2) * (pow - 1);
                    pow *= (k - 1);
                }
                pow = (k - 1);
                for (int i = 0; i <= rem / 2 - 1; ++i) {
                    count += (k - 2) * (pow - 1);
                    pow *= (k - 1);
                }
            } else {
                int pow = k - 1;
                for (int i = 0; i <= rem / 2 - 1; ++i) {
                    count += 2 * (k - 2) * (pow - 1);
                    pow *= (k - 1);
                }
            }
            return count >= n;
        }

        class Pair {
            int first;
            int second;

            Pair(int first, int second) {
                this.first = first;
                this.second = second;
            }

        }

        class Vertex {
            int id;
            boolean marked;
            int edgeCount = 0;
            List<Vertex> adj = new ArrayList<>();

            Vertex(int id) {
                this.id = id;
            }

            int connect(int cur, int curDepth, int depth) {
                this.marked = true;
                if (curDepth >= depth) return cur;
                for (int i = edgeCount; i < k; ++i) {
                    if (cur >= n) break;
                    edge.add(new Pair(id, cur));
                    adj.add(mapping.get(cur));
                    mapping.get(cur).edgeCount++;
                    ++cur;
                }
                for (Vertex v : adj) {
                    if (v.marked) continue;
                    cur = v.connect(cur, curDepth + 1, depth);
                }
                return cur;
            }

        }

    }

    static class InputReader {
        private BufferedReader reader;
        private StringTokenizer tokenizer;

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

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

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

    }
}

