def main():
    n, d, k = map(int, input().split())
    if k == 1 and d != n - 1 or k > 1 and (k ** ((d // 2) + 1) - 1) // (k - 1) * (d % 2 + 1) - d % 2 < n:
        print('NO')
        return

    def dfs(parent, depth, src):
        for _ in range(k):
            child = src.pop()
            res.append('%s %s' % (parent, child))
            if depth:
                dfs(child, depth - 1, src)

    res = ['YES']
    for p in enumerate(range(2, d // 2 + 2), 1):
        res.append('%d %d' % p)
    rest = list(range(d // 2 + 2, n + 1))
    try:
        k -= 1
        dfs(1, d // 2 - 1, rest)
        if not d % 2:
            p = rest.pop()
            res.append('1 %d' % p)
            dfs(p, d // 2 - 1, rest)
        k -= 1
        for p in range(2, d // 2 + 1):
            dfs(p, d // 2 - 2, rest)
    except IndexError:
        pass
    print('\n'.join(res))


if __name__ == '__main__':
    main()
