You are given three integers n, d and k.

Your task is to construct an undirected tree on n vertices with diameter d and degree of each vertex at most k, or say that it is impossible.

An undirected tree is a connected undirected graph with n - 1 edges.

Diameter of a tree is the maximum length of a simple path (a path in which each vertex appears at most once) between all pairs of vertices of this tree.

Degree of a vertex is the number of edges incident to this vertex (i.e. for a vertex u it is the number of edges (u, v) that belong to the tree, where v is any other vertex of a tree).

Input

The first line of the input contains three integers n, d and k (1 ≤ n, d, k ≤ 4 ⋅ 10^5).

Output

If there is no tree satisfying the conditions above, print only one word "NO" (without quotes).

Otherwise in the first line print "YES" (without quotes), and then print n - 1 lines describing edges of a tree satisfying the conditions above. Vertices of the tree must be numbered from 1 to n. You can print edges and vertices connected by an edge in any order. If there are multiple answers, print any of them.1

Examples

Input

6 3 3


Output

YES
3 1
4 1
1 2
5 2
2 6


Input

6 2 3


Output

NO


Input

10 4 3


Output

YES
2 9
2 10
10 3
3 1
6 10
8 2
4 3
5 6
6 7


Input

8 5 3


Output

YES
2 5
7 2
3 7
3 1
1 6
8 7
4 3
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;
		}
		
	}

}