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