Write a program that takes a URL to an HTML document as an argument, fetches the document, extracts and prints all URLs contained within, and then repeats the process recursively for each URL it found, up to a configurable depth.