
 #include <map>
#include <cmath>
#include <cstdio>
#include <vector>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <bits/stdc++.h>


#define ll long long int
#define ld long double
#define gch(ch) scanf("%c",&ch)
#define gcharr(arr,n) FOR(i,0,n) gch(arr[i])

#define gi(x) scanf("%d",&x)
#define gi2(x,y) scanf("%d %d",&x,&y)
#define gi3(x,y,z) scanf("%d %d %d",&x,&y,&z)
#define pi(x) printf("%d ",x)

#define gll(x) scanf("%lld",&x)
#define gll2(x,y) scanf("%lld %lld",&x,&y)
#define gll3(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)
#define pll(x) printf("%lld ",x)

#define gld(x) scanf("%lf",&x)
#define pld(x) printf("%ld ",x)

#define pline printf("\n")

#define fori(i,a,b) for(ll i=a;i<b;i++)
#define ford(i,a,b) for(ll i=a;i>=b;i--)
#define deb(x) cout<<#x<<" : "<<x<<endl;
#define debug(x,y) cout<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<endl;
#define SYNC ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define PI pair<int,int>
#define PLL pair<ll , ll>
#define VI vector<int>
#define VLL vector<ll>
#define mmul(a,b) ((a*b)%mod)
#define msub(a,b) (((a-b)+mod)%mod)
#define madd(a,b) ((a+b)%mod)
#define mdiv(a,b) ((a*powin(b,mod-2))%mod)
using namespace std;
ll gcd (ll a,ll b)
{
    if(b!=0)
        return gcd(b,a%b);
    else
        return a;
}
ll mod=1000000007ll;
ll power(ll a,ll b)
{
    if(b==0)
    return 1;
    if(b==1)
    return a;
    if(b%2==0)
    {
        ll t=power(a,b/2);
        return t*t;

    }
    else
    {
        ll t=power(a,b/2);
        return a*t*t;
    }
}
ll powin(ll a,ll b)
{
    if(b==0)
        return 1;
    else if(b==1)
    return a;
    else if(b%2==0)
    {
        ll t=powin(a,b/2);
        return (t*t)%mod;
    }
    else
    {
        ll t=powin(a,b/2);
        return (((t*t)%mod)*a)%mod;
    }
}
#define N 400009
ll p1=1001197;
ll h[N];
ll pw[N];
ll rv[N];
vector<int> v[400009];
int deg[N]={0};
int len[N]={0};
int g;
int n,d,k;
int f=0;
void fun(int i,int rem)
{
   // cout<<i<<" "<<rem<<endl;
    if(rem<=0)return ;
    if(i==n)return ;
    if(f==1 && rem==0 && g<=n)
    {
        deg[i]++;
        deg[g]++;
        v[i].push_back(g++);
    }
    while(deg[i]<k && g<=n)
    {
        v[i].push_back(g);
        deg[i]++;
        deg[g]++;
        g++;
        fun(g-1,rem-1);
    }
}
int main()
{
    SYNC

    cin>>n>>d>>k;
    
    int t=d;
    int i=1;
    int j=d+1;
    while(t>1)
    {
        
        
        len[i]=len[j]=j-1;
        v[i].push_back(i+1);
        v[j-1].push_back(j);
        deg[i]++;
        deg[i+1]++;
        deg[j]++;
        deg[j-1]++;
        i++;
        j--;
        t-=2;
        
    }
    if(t==1)
    {
        v[i].push_back(j);
        deg[i]++;
        deg[j]++;
        len[j]=j-1;
        len[i]=j-1;
    }
    else 
    {
        len[i]=j-1;
    }
  
    
    int che[n+10]={0};
    g=d+2;
    for(int i=1;i<=1+d;i++)
    {
        while(len[i]<d && deg[i]<k)
        {
            
            if(che[i]==0)
            {
                deg[i]++;
                deg[g]++;
                v[i].pb(g);
           //     cout<<i<<" "<<g<<endl;
                g++;
                
                
                f=1;
                
                fun(g-1,(d-1-len[i]+1)/2);
                che[i]=1;
                
            }
            else 
            {
                
                deg[i]++;
                deg[g]++;
                v[i].pb(g);
              //  cout<<i<<" "<<g<<endl;
                g++;
                f=0;
                
                
                fun(g-1,(d-1-len[i])/2);
                che[i]=1;
                
            }
            
            if(g>n)
            {
                break;
            }
        }
        
        
    }
    if(g<n)cout<<"NO";
    else 
    {
        cout<<"YES"<<endl;
        for(int i=1;i<=n;i++)
        {
            for(int j=0;j<v[i].size();j++)cout<<i<<" "<<v[i][j]<<endl;
        }
    }
    return 0;
}

