Least Runtime Solution
\nclass Solution:\n    def findCriticalAndPseudoCriticalEdges(self, n: int, edges: List[List[int]]) -> List[List[int]]:\n        du = list(range(n))\n        de
```\nclass Solution:\n    def findCriticalAndPseudoCriticalEdges(self, n: int, edges: List[List[int]]) -> List[List[int]]:\n        du = list(range(n))\n        def ufind(x):\n            st = x\n            while du[x] != x:\n                x = du[x]\n            while du[st] != x:\n                y = du[st]\n                du[st] = x\n                st = y\n            return x\n        def uunion(x,y):\n            x = ufind(x)\n            y = ufind(y)\n            if x > y:\n                x,y = y,x\n            du[y] = x\n        def dfs(node):\n            dfstack.append(node)\n            for nxt in eg[node]:\n                if nxt not in backward:\n                    backward[nxt] = node\n                    dfs(nxt)\n        \n        outc = []\n        outp = []\n        eidx = {tuple(eg[:2]):idx for idx,eg in enumerate(edges)}\n        edges.sort(key = itemgetter(2), reverse = True)\n        while edges:\n            egw = edges[-1][-1]\n            eg = defaultdict(list)\n            egcur = []\n            while edges and edges[-1][-1] == egw:\n                ea,eb,_ = edges.pop()\n                if (eac := ufind(ea)) != (ebc := ufind(eb)):\n                    eg[eac].append(ebc)\n                    eg[ebc].append(eac)\n                    egcur.append((ea,eb))\n            if not eg:\n                continue\n            \n            dfstack = []\n            backward = dict()\n            for root in eg.keys():\n                if root not in backward:\n                    backward[root] = -1\n                    dfs(root)\n            dfsidx = [0]*n\n            for idx,node in enumerate(dfstack):\n                dfsidx[node] = idx\n            egt = dict()\n            for eac,ebclist in eg.items():\n                ebct = [ebc for ebc in ebclist if dfsidx[ebc] > dfsidx[eac]]\n                egt[eac] = ebct\n            for ebc,eac in backward.items():\n                if eac != -1:\n                    egt[eac].remove(ebc)\n                    egt[ebc].append(eac)\n\n            visit_v = set()\n            visit_e = set()\n            for node in dfstack:\n                visit_v.add(node)\n                for nxt in egt[node]:\n                    if backward[node] != nxt and (node,nxt) not in visit_e:\n                        prev = node\n                        while nxt not in visit_v:\n                            visit_v.add(nxt)\n                            visit_e.add((prev,nxt))\n                            visit_e.add((nxt,prev))\n                            prev = nxt\n                            nxt = backward[nxt]\n                        visit_e.add((prev,nxt))\n                        visit_e.add((nxt,prev))\n            for egc in egcur:\n                ea,eb = egc\n                eac = ufind(ea)\n                ebc = ufind(eb)\n                if (eac,ebc) in visit_e:\n                    outp.append(eidx[egc])\n                else:\n                    outc.append(eidx[egc])\n            for eac in eg:\n                for ebc in eg[eac]:\n                    uunion(eac,ebc)\n        return [outc,outp]\n```
['Union Find']