import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.InputMismatchException;

public class E {
    public static void main(String args[])
    {
        FastReader Reader=new FastReader(System.in);
        int N=Reader.nextInt();
        int D=Reader.nextInt();
        int K=Reader.nextInt();
        ArrayList<int[]> arr=new ArrayList<>();
        if(N==1)
        {
            System.out.println("NO");
        }
        else if(N==2)
        {
            if(D==1) {
                System.out.println("YES");
                System.out.println("1 2");
            }
            else
            {
                System.out.println("NO");
            }

        }
        else
        {
            int child[]=new int[N+1];
            int visited[]=new int[D];
            boolean flag=true;
            ArrayList<Integer> level[]=new ArrayList[D];
            level[0]=new ArrayList<>();
            visited[0]=1;
            level[0].add(1);
            level[1]=new ArrayList<>();
            level[1].add(2);
            int temp[]=new int[2];
            temp[0]=1;
            temp[1]=2;
            arr.add(temp);
            child[1]++;
            child[2]++;
            visited[1]=1;
            int curr=3;
            for(int i=0;i<D-1;i++)
            {
                if(curr>N)
                {
                    flag=false;
                    break;
                }
                if(visited[i+1]==0)
                {
                    level[i+1]=new ArrayList<>();
                    level[i+1].add(curr);
                    visited[i+1]=1;
                    int tempy[]=new int[2];
                    tempy[0]=curr-1;
                    tempy[1]=curr;
                    if(child[tempy[0]]+1>K)
                    {
                        flag=false;
                        break;
                    }
                    else
                    {
                        child[tempy[0]]++;
                        child[tempy[1]]++;
                        arr.add(tempy);
                    }
                    curr++;
                }
                else
                {
                    level[i+1].add(curr);
                    if(child[1]+1>K)
                    {
                        flag=false;
                        break;
                    }
                    else
                    {
                        int tempy[]=new int[2];
                        tempy[0]=1;
                        tempy[1]=curr;
                        child[tempy[0]]++;
                        child[tempy[1]]++;
                        arr.add(tempy);
                    }
                    curr++;
                }
            }
            if(flag==true) {
                boolean flag2=false;
                for (int i = 0; i < D - 1; i++) {
                    for (int j = 0; j < level[i].size(); j++) {
                        int a = level[i].get(j);
                        if (a != 2) {
                            //System.out.println(a+" "+child[a]);
                            if (child[a] < K) {
                                int diff = K - child[a];
                                for (int k = curr; k < curr + diff; k++) {
                                    int tempy[]=new int[2];
                                    tempy[0] = a;
                                    tempy[1] = k;
                                    if(k>N)
                                    {
                                        flag2=true;
                                        break;
                                    }
                                    child[a]++;
                                    child[k]++;
                                    level[i+1].add(k);
                                    arr.add(tempy);
                                }
                                if(flag2==true)
                                    break;
                                curr=curr+diff;
                                if(curr>N)
                                {
                                    flag2=true;
                                    break;
                                }
                            }
                        }
                    }
                }
                if(flag2) {
                    System.out.println("YES");
                    for (int i = 0; i < arr.size(); i++) {
                        int x[] = arr.get(i);
                        System.out.println(x[0] + " " + x[1]);
                    }
                }
                else
                    System.out.println("NO");
            }
            else
            {
                System.out.println("NO");
            }
        }
    }

}
class FastReader {
    private InputStream stream;
    private byte[] buf = new byte[8192];
    private int curChar;
    private int pnumChars;
    private FastReader.SpaceCharFilter filter;

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

    public int read() {
        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 String next() {
        return nextString();
    }

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

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

    public String nextString() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isSpaceChar(c));
        return res.toString();
    }

    public String nextLine() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isEndOfLine(c));
        return res.toString();
    }


    public boolean isEndOfLine(int c) {
        return c == '\n' || c == '\r' || c == -1;
    }

    public boolean isSpaceChar(int c) {
        if (filter != null) {
            return filter.isSpaceChar(c);
        }
        return isWhitespace(c);
    }

    public static boolean isWhitespace(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    public interface SpaceCharFilter {
        public boolean isSpaceChar(int ch);

    }

}
