Use DFS algorithm for FIRST.