assignment 4 - g and greverse with iterative dfs