added naive dfs with non-recursive