depth-first search for realz