Dfs Algorithm In Python Using A Stack In Java