Driver code
if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT g = [ [ ] for i in range ( 100005 ) ] NEW_LINE edges = 6 NEW_LINE g [ 18 ] . append ( 7 ) NEW_LINE g [ 7 ] . append ( 18 ) NEW_LINE g [ 18 ] . append ( 15 ) NEW_LINE g [ 15 ] . append ( 18 ) NEW_LINE g [ 15 ] . append ( 2 ) NEW_LINE g [ 2 ] . append ( 15 ) NEW_LINE g [ 7 ] . append ( 4 ) NEW_LINE g [ 4 ] . append ( 7 ) NEW_LINE g [ 7 ] . append ( 12 ) NEW_LINE g [ 12 ] . append ( 7 ) NEW_LINE g [ 12 ] . append ( 9 ) NEW_LINE g [ 9 ] . append ( 12 ) NEW_LINE root = 18 NEW_LINE print ( dfs ( g , root , - 1 ) ) NEW_LINE DEDENT