Problem G. Depth-First Search

HDU - 6338