c++ solution using dfs
\nWe will create unordered map to store the edges, and for each nnode we will visit the other nodes from map and check if that is already visited using dfs. If 
\nWe will create unordered map to store the edges, and for each nnode we will visit the other nodes from map and check if that is already visited using dfs. If it already is visited means it creates a cycle.\n    \nWe add edges one by one in graph and as soon as adding any edge creates the cycle, we will return the result.\n\n\n```\nclass Solution {\npublic:\n\nbool dfs(unordered_map<int, vector<int>> &m, int node, vector<int> visited, int parent)\n{\n    if(find(visited.begin(),visited.end(),node)!=visited.end())\n        return true;\n    visited.push_back(node);\n      //  cout<<node<<" "<<visited.size()<<endl;\n        for(int v: m[node]){\n            if(v==parent)\n                continue;\n            if(dfs(m,v,visited,node)){\n                return true;\n            }\n        }\n    \n    return false;\n}\n\nvector<int> findRedundantConnection(vector<vector<int>>& A)\n    {\n        int n = A.size();\n        vector<int> visited;\n        \n        unordered_map<int, vector<int>> m;\n        \n        for(int i=0;i<n;i++)\n        {\n            int f = A[i][0];\n            int s = A[i][1];\n            \n            m[f].push_back(s);\n            m[s].push_back(f);             \n          //  cout<<"***** "<<f<<" *****\\n";\n            if(dfs(m,f,visited,-1))         \n            {\n              return {f,s};\n            }\n            visited.clear();\n        }\n        \n        return {};\n    }\n};\n```\n\n![image](https://assets.leetcode.com/users/images/c0f36e0a-df64-4a84-b351-4209d0b377fb_1619764417.8728948.jpeg)\n
['Depth-First Search', 'C', 'C++']