// author : Gabriel Hofer
function p ( a ) { print ( a ); }
var n, d, k;
var line = readline ();
line = line.trim ().split ( ' ' );
n = (+ line [ 0 ]);
d = (+ line [ 1 ]);
k = (+ line [ 2 ]);
var n_ = (+ n);
//---------------------------------------------------------
function get_index ( a ) {
    if ( arr.length == 0 ) return 0;
    var l, r, m;
    l = 0, r = arr.length;
    while ( l < r ) {
        m = Math.floor ( (l + r) / 2 ); 
        if ( a < arr [ m ][ 0 ] ) r = m;
        else if ( a > arr [ m ][ 0 ] ) l = m + 1;
        else return m;
    }
    m = Math.floor ( (l + r) / 2 ); 
    return m;
}
function enqueue ( a, b, c ) {
    var index = get_index ( a );
    arr.splice ( index, 0, [ a, b, c ] );
}
function dequeue ( ) {
    return arr.shift ();
}
//---------------------------------------------------------
var arr = [ ]; // priority queue
var graph = { };
var other = { };
var i;
n --;
for ( i = 2; i <= (d + 1); i ++ ) {
    if ( ! ( i in graph ) ) graph [ i ] = { };
    graph [ i ][ i - 1 ] = 1;
    if ( ! ( i in other ) ) other [ i ] = { };
    other [ i ][ i - 1 ] = 1;
    if ( ! ( (i - 1) in other ) ) other [ i - 1 ] = { };
    other [ i - 1 ][ i ] = 1;
    if ( i < (d + 1) )
        enqueue ( Math.max ( d - i + 1, i - 1 ), 2, i );
    n --;
}
var elem;
var eccentricity;
var degree;
var node;
var curr = d + 2;
aa: while ( n > 0 ) {
    while ( (arr.length > 0) && arr [ 0 ][ 1 ] >= k ) arr.shift ();
    var elem = dequeue ( );
    eccentricity = elem [ 0 ]; 
    degree = elem [ 1 ];
    node = elem [ 2 ];
    var orig = degree; // store the original eccentricity for this node
    while ( degree < k && n > 0 ) {
        if ( ! ( node in graph ) ) graph [ node ] = { };
        graph [ node ][ curr ] = 1;
        if ( ! ( node in other ) ) other [ node ] = { };
        other [ node ][ curr ] = 1;
        if ( ! ( curr in other ) ) other [ curr ] = { };
        other [ curr ][ node ] = 1;

        enqueue ( (+ eccentricity) + 1, 1, curr );
        curr ++;
        degree ++;
        n --;
    }
}
var visit = { };
var dist = dfs ( n_ );
dist --;
if ( dist > d ) {
    print ( 'NO' );
} else {
    print ( 'YES' );
    for ( var g in graph ) 
        for ( var h in graph [ g ] ) 
            print ( g + ' ' + h );
}
function dfs ( who ) {
    if ( who in visit ) return 0;
    visit [ who ] = 1;
    var mx = 1;
    var v;
    for ( var h in other [ who ] ) {
        v = 1 + dfs ( h );
        if ( v > mx ) mx = v;
    }
    return mx;
}
