Done with depth-first.