Depth first search.