Python3 Solution
\n\nclass Solution :\n    def find(self,u,parent):\n        if u==parent[u]:\n            return u\n        return self.find(parent[u],parent)\n\n    def unionD
\n```\nclass Solution :\n    def find(self,u,parent):\n        if u==parent[u]:\n            return u\n        return self.find(parent[u],parent)\n\n    def unionDSU(self,u,v,parent) :\n        p1=self.find(u,parent)\n        p2=self.find(v,parent)\n        parent[p2]=p1\n\n    def mst(self,k,edges,includeEdge,excludeEdge) :\n        n=len(includeEdge)\n        m=len(excludeEdge)\n        parent=[]\n        for i in range(k): \n            parent.append(i);\n        \n        res=0\n        count=0\n\n        if n!= 0 :\n            self.unionDSU(includeEdge[0], includeEdge[1], parent)\n            res+=includeEdge[2]\n            count+=1\n        \n        for edge in edges:\n            u=edge[0];\n            v=edge[1];\n            cost=edge[2];\n\n            if m!=0 and excludeEdge[0]==u and excludeEdge[1]==v and excludeEdge[2]==cost :\n                continue\n            \n            if n!=0 and includeEdge[0]==u and includeEdge[1]==v and includeEdge[2]==cost :\n                continue\n            \n            p1=self.find(u,parent)\n            p2=self.find(v,parent)\n\n            if p1!= p2:\n                self.unionDSU(p1, p2, parent)\n                res+= cost\n                count += 1\n                    \n        return  res if count==k-1 else float(\'inf\')\n    \n    def findCriticalAndPseudoCriticalEdges(self, k:int, edges:List[List[int]]) -> List[List[int]]:\n        \n        originalEdges=[]\n        for edge in edges : \n            originalEdge=[edge[0],edge[1],edge[2]]\n            originalEdges.append(originalEdge)\n            \n        X=len(originalEdges)\n        ans=[]\n        criticalEdges=[]\n        pseudoCriticalEdges=[]\n\n        \n        edges=sorted(edges, key = lambda x: x[2])\n\n        emptyVector=[]\n        originalCost = self.mst(k, edges, emptyVector, emptyVector)\n        \n        for i in range(X): \n            excludedCost = self.mst(k, edges, emptyVector, originalEdges[i])\n            includedCost = self.mst(k, edges, originalEdges[i], emptyVector)\n\n            if excludedCost > originalCost :\n                criticalEdges.append(i)\n                \n            elif includedCost==originalCost : \n                pseudoCriticalEdges.append(i)\n                    \n        ans.append(criticalEdges)\n        ans.append(pseudoCriticalEdges)\n        return ans\n```
['Python', 'Python3']