import java.util.Scanner;

public class Main {
    static Scanner in = new Scanner (System.in);
    static int n = in.nextInt();
    static int d = in.nextInt();
    static int k = in.nextInt();
    static int[][] graf = new int[n + 1][n + 1];
    static int[][] answer = new int[n + 1][n + 1];
    static int count = 0;

    private static void rec (int ver, int str, int globalOst, int localOst){
        graf[ver][str] = 1;
        graf[ver][0] = 1;
        for (int i = 1; i <= n; i++){
//            System.out.println(ver + " " + i);
            if ((graf[ver][i] == 0) && (i != ver) && (globalOst > 0) && (localOst > 0) && graf[i][0] == 0){
                graf[ver][i] = 1;
                localOst--;
                answer[count][0] = ver;
                answer[count][1] = i;
                count++;
                rec (i, ver, globalOst - 1, k);
            }
        }
    }

    public static void main(String[] args) {

//        Contest494_E w = new Contest494_E();
//        w.qwerty();
        if (d > n){
            System.out.print("NO");
        }
        else {
            rec(1, 1, d - 1, k);
            if (count != n - 1){
                System.out.print("NO");
            }
            else{
                System.out.println("YES");
                for (int i = 0; i < n - 1; i++){
                    System.out.println(answer[i][0] + " " + answer[i][1]);
                }
            }
        }
    }
}
