import java.io.*;
import java.util.*;
import java.util.Map.Entry;
import java.lang.Math;
import java.time.format.DateTimeFormatter;
import java.time.LocalDateTime;

// CODEFORCES
public class main {

	static int cycleNum;

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);

		int n = scanner.nextInt();
		int d = scanner.nextInt();
		int k = scanner.nextInt();
//		int q = scanner.nextInt();
//		int[][] ts = new int[k][2];
//		int[] cols = new int[q];
//		
//		String[] s1 = scanner.nextLine().split(" ");
//		for (int i = 0; i < k; i++) {
//		    s1 = scanner.nextLine().split(" ");
//		    ts[i][0] = Integer.valueOf(s1[0]);
//		    ts[i][1] = Integer.valueOf(s1[1]);
//		}
//		s1 = scanner.nextLine().split(" ");
//		for (int i = 0; i < q; i++) {
//		    cols[i] = Integer.valueOf(s1[i]);
//		}
//		Arrays.sort(cols);
//		
//		String[] s1 = new String[n];
//		String [] s2 = new String[n];
//		
//		s1 = scanner.nextLine().split(" ");
//		s2 = scanner.nextLine().split(" ");

//		scanner = new Scanner(System.in);
//		String[] s = scanner.nextLine().split(" ");

//	String[] str1 = new String[4];
//		str1 = scanner.nextLine().split(" ");
//		String[] str2 = new String[Integer.valueOf(str1[0])];
//		while(scanner.hasNextLine()){
//			str2 = scanner.nextLine().split(" ");
//		}

//		int[] p = new int[n];
//		int[] q = new int[n];
//		for (int i = 0; i < s1.length; i++) {
//			p[i] = Integer.valueOf(s1[i]);
//			q[i] = Integer.valueOf(s2[i]);
//		}

// 		int n = 10;
// 		int d = 4;
// 		int k = 3;
		HashMap<Integer, ArrayList<Integer>> g = new HashMap<>();
		int d1 = 0;
		int d2 = 0;
		ArrayList<Integer> t1 = new ArrayList<>();
		g.put(1, t1);

		if (n - 1 < k) {
			System.out.println("YES");
			for (int i = 2; i < n+1; i++) {
				System.out.println(String.valueOf(1) + " " + String.valueOf(i));
			}
		} else {
			for (int i = 2; i < 2 + k; i++) {
				g.get(1).add(i);
				if (g.containsKey(i)) {
					g.get(i).add(1);
				} else {
					ArrayList<Integer> t = new ArrayList<Integer>();
					t.add(1);
					g.put(i, t);
				}
			}

			int currV = 2 + k;
			int currP = 2;
			while (currV <= n) {
				int degree = g.get(currP).size();
				while (degree < k) {
					g.get(currP).add(currV);
					ArrayList<Integer> t2 = new ArrayList<Integer>();
					t2.add(currP);
					g.put(currV, t2);
					currV += 1;
					degree += 1;
					if (currV > n) {
						break;
					}
				}
				
				currP += 1;
			}
			if (diameter(g) <= d) {
				System.out.println("YES");
				HashMap<String, Integer> edges = new HashMap<>();
				for (Map.Entry<Integer,ArrayList<Integer>> entry : g.entrySet())  {
					for (int i = 0; i < entry.getValue().size(); i++) {
						int[] edge = new int[2];
						edge[0] = Math.min(entry.getKey(), entry.getValue().get(i));
						edge[1] = Math.max(entry.getKey(), entry.getValue().get(i));
						String edgeStr = String.valueOf(edge[0]) + " " + String.valueOf(edge[1]);
						if (!edges.containsKey(edgeStr)) {
							System.out.println(String.valueOf(edge[0]) + " " + String.valueOf(edge[1]));
							edges.put(edgeStr, 1);
						}
					}
				}
			} else {
				System.out.println("NO");
			}
		}
		
		
	}
	
	static int diameter(HashMap<Integer, ArrayList<Integer>> g) {
		int[] max = new int[2];
		longestBfs(g, 1, -1, 0, max);
		int[] max2 = new int[2];
		longestBfs(g, max[1], -1, 0, max2);
		return max2[0];
	}
	
	static void longestBfs(HashMap<Integer, ArrayList<Integer>> g, int curr, int p, int d, int[] max) {
		if (d > max[0]) { 
			max[0] = d;
			max[1] = curr;
		}
		for (int i = 0; i < g.get(curr).size(); i++) {
			if (g.get(curr).get(i) == p) { continue; }
			longestBfs(g, g.get(curr).get(i), curr, d+1, max);
		}
	}
	
	
	

}

//List sortedKeys=new ArrayList(trip.keySet());
//Collections.sort(sortedKeys);