Storing the path from root to node
def dfs ( cur : int , prev : int , pathNumber : int , ptr : int , node : int ) -> None : NEW_LINE INDENT global tree , path , flag NEW_LINE for i in range ( len ( tree [ cur ] ) ) : NEW_LINE INDENT if ( tree [ cur ] [ i ] != prev and not flag ) : NEW_LINE DEDENT DEDENT