#include<bits/stdc++.h>
using namespace std;
 
void solve()
{
   int n=10,d=4,k=3;
   cin>>n>>d>>k;
   int a=0,b=0;  
   queue<int> lol;
   int id[n+1]={0},cost[n+1]={0};
   if(d>n-1)
   {
       cout<<"NO\n";
       return;
   }
  vector<pair<int,int> >ok;
      
   if(d==n-1)
   {
       cout<<"YES\n";
      for(int i=0;i<n-1; i++)
        cout<<i+1<<" "<<i+2<<"\n";
        return ;
   }
   else{
       int count=0;
       int gg=0;
       for(int i=2;i<k+2; i++)
       {
           ok.push_back({1,i});
           //cout<<"1 "<<i<<"\n";
           a=1;
           if(i==3)
           {
               b=1;
           }
           count++;
           lol.push(i);
           id[i]=i;
           gg=i;
           cost[i]=1;
           if(n-1-count+a+b==d)
           {
               break;
           }
       }
       while(!lol.empty())
       {
           int u=lol.front();
           lol.pop();
           if(gg>=n)
           break;
           for(int i=0;i<k-1; i++)
           {

               
                   if(a+b-count+n-1==d&&(id[u]>3||(id[u]==2&&cost[u]+1==a)||(id[u]==3&&cost[u]+1==b)))
                   {
                       break;
                   }
               if(gg==n)
               {
                   break;
               }
               gg++;
               //cout<<u<<" "<<gg<<"\n";
               ok.push_back({u,gg});
               lol.push(gg);
               id[gg]=id[u];
               count++;
                if(id[u]==2)
                {
                    a=cost[u]+1;
                    cost[gg]=a;
                }
                if(id[u]==3)
                {
                    b=cost[u]+1;
                    cost[gg]=b;
                }
           }
       }
   }
   if(a+b!=d)
   {
       //cout<<a<<" "<<b<<"\n";
       cout<<"NO\n";
   }
   else{
       cout<<"YES\n";
       for(int i=0;i<ok.size();i++)
       {
           cout<<ok[i].first<<" "<<ok[i].second<<"\n";
       }
   }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;
    t=1;
    while(t--)
    solve();
}




