C++ solution using dfs
\nclass Solution {\n    bool dfs(int node, int parent, vector<vector<int>>& adj, vector<bool>& vis) {\n        vis[node] = true;\n        for(auto it : adj[node
```\nclass Solution {\n    bool dfs(int node, int parent, vector<vector<int>>& adj, vector<bool>& vis) {\n        vis[node] = true;\n        for(auto it : adj[node]) {\n            if(!vis[it]){\n                if(dfs(it, node, adj, vis)) return true;\n            }else if(it!=parent) return true;\n        }\n        return false;\n    }\npublic:\n    vector<int> findRedundantConnection(vector<vector<int>>& edge) {\n        int n = edge.size();\n        vector<vector<int>> adj(n+1);\n        vector<bool> vis(n+1, 0);                \n        for(auto i : edge) {\n            fill(begin(vis), end(vis), 0);\n            adj[i[0]].push_back(i[1]);\n            adj[i[1]].push_back(i[0]);\n            if(dfs(i[0], -1, adj, vis)) return i;\n        }\n        return {};\n    }\n\n};\n```
['Depth-First Search', 'C']