
import java.awt.Point;
import java.util.Scanner;
import java.util.SortedSet;
import java.util.TreeSet;

public class E {

    public static void main(String args[]) {
        new E().run();
    }

    void run() {
        Scanner s = new Scanner(System.in);
        long n = s.nextInt();
        long d = s.nextInt();
        long k = s.nextInt();

        if (n == 1) {
            System.out.println("YES");
            return;
        }

        long r = 1;
        long rb = k;
        int i = 0;
        for (; i < d - 1; i += 2) {
            r += rb;
            rb *= k - 1;
        }
        if (i == d - 1) {
            r += k - 1;
        }
        SortedSet<Integer> l = new TreeSet<>();
        l.add(1);
        int next = 2;

        if (r >= n) {
            System.out.println("YES");
            n -= 2;
            System.out.println("1 2");
            next++;
            l.add(2);
            while (n > 0) {
                int a = l.first();
                l.remove(a);
                for (i = 0; i < k - 1 && n > 0; i++, n--) {
                    System.out.println(a + " " + next);
                    l.add(next);
                    next++;
                }
            }
        } else {

            System.out.println("NO");
        }

        System.out.println(r);
    }
}
