def main():
    n, d, k = list(map(int, input().split()))
    if n == d + 1 and k - 1:
        print("YES")
        for i in range(1, d + 1):
            print(i, i + 1)
        return 0
    if  n < d +1 or k <= 2 or d == 1:
        print("NO")
        return 0
    if d % 2 == 0:
        if n * (k - 2) > -2 + k * (k - 1) ** (d // 2):
            print("NO")
            return 0
        print("YES")
        for i in range(1, d + 1):
            print(i, i + 1)
        nodes = d + 1
        leaves = [1 + d // 2]
        while True:
            new_leaves = []
            for i in leaves:
                for j in range(k - 1 - (i <= d + 1)):
                    nodes += 1
                    print(i, nodes)
                    new_leaves.append(nodes)
                    if nodes == n:
                        return 0
            leaves = new_leaves
    else:
        if n * (k - 2) > -2 + k * (k - 1) ** (d // 2) + (k - 2) * (k - 1) ** (d // 2):
            print("NO")
            return 0
        print("YES")
        for i in range(1, d + 1):
            print(i, i + 1)
        nodes = d + 1
        leaves = [1 + d // 2, 2 + d // 2]
        while True:
            new_leaves = []
            for i in leaves:
                for j in range(k - 1 - (i <= d + 1)):
                    nodes += 1
                    print(i, nodes)
                    new_leaves.append(nodes)
                    if nodes == n:
                        return 0
            leaves = new_leaves
main()
