You are given three integers n, d and k.

Your task is to construct an undirected tree on n vertices with diameter d and degree of each vertex at most k, or say that it is impossible.

An undirected tree is a connected undirected graph with n - 1 edges.

Diameter of a tree is the maximum length of a simple path (a path in which each vertex appears at most once) between all pairs of vertices of this tree.

Degree of a vertex is the number of edges incident to this vertex (i.e. for a vertex u it is the number of edges (u, v) that belong to the tree, where v is any other vertex of a tree).

Input

The first line of the input contains three integers n, d and k (1 ≤ n, d, k ≤ 4 ⋅ 10^5).

Output

If there is no tree satisfying the conditions above, print only one word "NO" (without quotes).

Otherwise in the first line print "YES" (without quotes), and then print n - 1 lines describing edges of a tree satisfying the conditions above. Vertices of the tree must be numbered from 1 to n. You can print edges and vertices connected by an edge in any order. If there are multiple answers, print any of them.1

Examples

Input

6 3 3


Output

YES
3 1
4 1
1 2
5 2
2 6


Input

6 2 3


Output

NO


Input

10 4 3


Output

YES
2 9
2 10
10 3
3 1
6 10
8 2
4 3
5 6
6 7


Input

8 5 3


Output

YES
2 5
7 2
3 7
3 1
1 6
8 7
4 3
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.PriorityQueue;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.HashSet;
import java.util.Objects;
import java.util.AbstractCollection;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.Comparator;
import java.io.InputStream;

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

    static class TaskE {
        public void solve(int testNumber, FastReader in, OutputWriter out) {
            Debug debug = new Debug();
            int n = in.nextInt();
            int d = in.nextInt();
            int K = in.nextInt();
            if (d > n - 1 || (n > 2 && K == 1)) {
                out.printLine("NO");
                return;
            }
            int[] deg = new int[n + 100];
            int[] value = new int[n + 100];
            HashSet<TaskE.Pair> set = new HashSet<>();
            PriorityQueue<Integer> priorityQueue = new PriorityQueue<>(new Comparator<Integer>() {

                public int compare(Integer o1, Integer o2) {
                    return deg[o2] - deg[o1];
                }
            });
            for (int i = 0; i < n; ++i) priorityQueue.add(i);

            int ptr = d + 1;
            for (int i = 0; i <= d; ++i) {
                value[i] = Math.min(i, d - i);
            }
            for (int i = 0; i + 1 <= d; ++i) {
                set.add(new TaskE.Pair(i, i + 1));
                deg[i] += 1;
                deg[i + 1] += 1;
                priorityQueue.add(i);
                priorityQueue.add(i + 1);
            }
            outer:
            while (!priorityQueue.isEmpty()) {
                int cur = priorityQueue.poll();
                if (ptr >= n) break;
                if (deg[cur] == K || value[cur] == 0) continue;
                int rem = K - deg[cur];
                for (int i = 0; i < rem; ++i) {
                    set.add(new TaskE.Pair(cur, ptr));
                    ++deg[cur];
                    ++deg[ptr];
                    value[ptr] = value[cur] - 1;
                    priorityQueue.add(cur);
                    priorityQueue.add(ptr);
                    ++ptr;
                    if (set.size() == n - 1) break outer;
                }
                if (set.size() == n - 1) break outer;
            }
            boolean check = true;
            for (int i = 0; i < n; ++i) check &= deg[i] > 0;
            if (!check) {
                out.printLine("NO");
            } else {
                out.printLine("YES");
                for (TaskE.Pair pair : set) out.printLine((pair.from + 1) + " " + (pair.to + 1));
            }
        }

        static class Pair implements Comparable<TaskE.Pair> {
            int from;
            int to;

            public Pair(int from, int to) {
                this.from = from;
                this.to = to;
            }


            public boolean equals(Object o) {
                if (this == o) return true;
                if (o == null || getClass() != o.getClass()) return false;
                TaskE.Pair pair = (TaskE.Pair) o;
                return from == pair.from &&
                        to == pair.to || from == pair.to && to == pair.from;
            }


            public String toString() {
                return "Pair{" +
                        "from=" + from +
                        ", to=" + to +
                        '}';
            }


            public int hashCode() {

                return Objects.hash(from, to);
            }


            public int compareTo(TaskE.Pair o) {
                if (from != o.from)
                    return from - o.from;
                return to - o.to;
            }

        }

    }

    static class Debug {
        PrintWriter out;
        boolean oj;
        boolean system;
        long timeBegin;
        Runtime runtime;

        public Debug(PrintWriter out) {
            oj = System.getProperty("ONLINE_JUDGE") != null;
            this.out = out;
            this.timeBegin = System.currentTimeMillis();
            this.runtime = Runtime.getRuntime();
        }

        public Debug() {
            system = true;
            oj = System.getProperty("ONLINE_JUDGE") != null;
            OutputStream outputStream = System.out;
            this.out = new PrintWriter(outputStream);
            this.timeBegin = System.currentTimeMillis();
            this.runtime = Runtime.getRuntime();
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[8192];
        private int curChar;
        private int pnumChars;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        private int pread() {
            if (pnumChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= pnumChars) {
                curChar = 0;
                try {
                    pnumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (pnumChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = pread();
            while (isSpaceChar(c))
                c = pread();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = pread();
            }
            int res = 0;
            do {
                if (c == ',') {
                    c = pread();
                }
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = pread();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
        }

        public void printLine(Object... objects) {
            print(objects);
            writer.println();
        }

        public void close() {
            writer.close();
        }

    }
}

