It seems to me the input from OJ is problematic. When a and b are neighbors, b is in a's neighbor list but a is not in b's neighbor list. Under such condition only certain algorithm can generate correct output.

I've pasted a BFS solution which is correct if a and b are put into to each other's neighbor list, but doesn't work properly under current OJ:

```
UndirectedGraphNode *cloneGraph(UndirectedGraphNode *node) {
//key -> old node, value -> the new copy
unordered_map<UndirectedGraphNode*, UndirectedGraphNode*> m;
//the queue always contains old nodes that haven't been copied
queue<UndirectedGraphNode*> q;
if(node)
q.push(node);
while(!q.empty()) {
UndirectedGraphNode* n = q.front();
q.pop();
if(m.count(n)) continue; // if the node is already copied, continue
// create the copy
m[n] = new UndirectedGraphNode(n->label);
// loop through the neighbors, if it's copied already, add the new copy to new copy's neighbor list
for(UndirectedGraphNode* oldNei : n->neighbors) {
if(m.count(oldNei)) {
UndirectedGraphNode* newNei = m[oldNei];
if(m[n]->neighbors.size()==n->neighbors.size())
continue;
m[n]->neighbors.push_back(newNei);
newNei->neighbors.push_back(m[n]);
}
else// if not in the map, it's not copied/visited yet
q.push(oldNei);
}
}
return m[node];
}
```

This won't pass case {-1,1#1} since 1 is neighbor of -1, but -1 is not neighbor of 1.

If you think the above algorithm is wrong, please point it out. Otherwise I think the OJ needs to be fixed.