def maxNumEdgesToRemove(self, n: int, edges: List[List[int]]) -> int:
        parent = list(range(n + 1))
        def findParent(i):
            while parent[i] != i:
                parent[i] = parent[parent[i]]
                i = parent[i]
            return i