Dfs Implementation In Python Using Global Variables