import java.io.*;
import java.util.*;

public class E implements Runnable{
	public static void main (String[] args) {new Thread(null, new E(), "_cf", 1 << 28).start();}

	public void run() {
		FastScanner fs = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		System.err.println("Print");

		int n = fs.nextInt(), d = fs.nextInt(), k = fs.nextInt();
		if(d > n-1) {
			System.out.println("NO");
			return;
		}
		
		ArrayList<Integer>[] adj = new ArrayList[n];
		for(int i = 0; i < n; i++) adj[i] = new ArrayList<>();
		boolean[] diam = new boolean[n];
		int[] depth = new int[n];
		int[] max = new int[n];
		for(int i = 0; i < d; i++) {
			adj[i].add(i+1);
			adj[i+1].add(i);
			diam[i] = diam[i+1] = true;
		}
		int put = d+1;
		for(int i = 1; i < d && put < n; i++) {
			int dist = Math.max(i, d-i);
			int maxDepth = d - dist;
			max[i] = maxDepth;
			ArrayDeque<Integer> dq = new ArrayDeque<>();
			dq.add(i);
			while(!dq.isEmpty() && put < n) {
				int u = dq.pollFirst();
				if(depth[u] == max[u]) continue;
				if(adj[u].size() == k) continue;
				while(adj[u].size() < k && put < n) {
					adj[u].add(put);
					adj[put].add(u);
					depth[put] = depth[u] + 1;
					max[put] = maxDepth;
					dq.add(put);
					put++;
				}
			}
		}

		boolean chk = chk(adj, n, d, k);
		if(!chk) {
			out.println("NO");
		}
		else {
			out.println("YES");
			for(int i = 0; i < n; i++) {
				for(int v : adj[i]) {
					if(i > v) continue;
					out.printf("%d %d\n", i+1, v+1);
				}
			}
		}
		
		out.close();
	}

	boolean chk(ArrayList<Integer>[] adj, int n, int d, int k) {
		int[] s1 = bfs(0, adj);
		int leaf = -1;
		for(int i = 0; i < adj.length; i++) {
			if(leaf == -1) leaf = i;
			else if(s1[i] > s1[leaf]) leaf = i;
		}
		int[] s2 = bfs(leaf, adj);
		int diam = 0;
		for(int i = 0; i < adj.length; i++)
			diam = Math.max(diam, s2[i]);
		if(diam != d) return false;
		for(int i = 0; i < adj.length; i++)
			if(adj[i].size() > k) return false;
		
		return true;
	}
	
	int[] bfs(int src, ArrayList<Integer>[] adj) {
		int n = adj.length;
		int[] dist = new int[n];
		Arrays.fill(dist, n+n+n);
		dist[src] = 0;
		ArrayDeque<Integer> bfs = new ArrayDeque<>();
		bfs.add(src);
		while(!bfs.isEmpty()) {
			int u = bfs.pollFirst();
			for(int v : adj[u]) {
				if(dist[v] != n+n+n) continue;
				dist[v] = dist[u]+1;
				bfs.add(v);
			}
		}
		return dist;
	}

	void sort (int[] a) {
		int n = a.length;
		for(int i = 0; i < 50; i++) {
			Random r = new Random();
			int x = r.nextInt(n), y = r.nextInt(n);
			int temp = a[x];
			a[x] = a[y];
			a[y] = temp;
		}
		Arrays.sort(a);
	}

	class FastScanner {
		public int BS = 1<<16;
		public char NC = (char)0;
		byte[] buf = new byte[BS];
		int bId = 0, size = 0;
		char c = NC;
		double num = 1;
		BufferedInputStream in;

		public FastScanner() {
			in = new BufferedInputStream(System.in, BS);
		}

		public FastScanner(String s) throws FileNotFoundException {
			in = new BufferedInputStream(new FileInputStream(new File(s)), BS);
		}

		public char nextChar(){
			while(bId==size) {
				try {
					size = in.read(buf);
				}catch(Exception e) {
					return NC;
				}                
				if(size==-1)return NC;
				bId=0;
			}
			return (char)buf[bId++];
		}

		public int nextInt() {
			return (int)nextLong();
		}

		public long nextLong() {
			num=1;
			boolean neg = false;
			if(c==NC)c=nextChar();
			for(;(c<'0' || c>'9'); c = nextChar()) {
				if(c=='-')neg=true;
			}
			long res = 0;
			for(; c>='0' && c <='9'; c=nextChar()) {
				res = (res<<3)+(res<<1)+c-'0';
				num*=10;
			}
			return neg?-res:res;
		}

		public double nextDouble() {
			double cur = nextLong();
			return c!='.' ? cur:cur+nextLong()/num;
		}

		public String next() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c>32) {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public String nextLine() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c!='\n') {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public boolean hasNext() {
			if(c>32)return true;
			while(true) {
				c=nextChar();
				if(c==NC)return false;
				else if(c>32)return true;
			}
		}
		
		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for(int i = 0; i < n; i++) res[i] = nextInt();
			return res;
		}
		
	}

}