basic recursive dfs