/in/foo.cc: In function 'void add(int, int)':
/in/foo.cc:15:5: error: reference to 'next' is ambiguous
next[++tot]=head[x];
^~~~
/in/foo.cc:9:5: note: candidates are: int next [1000]
int next[1000],to[1000];
^~~~
In file included from /usr/include/c++/6/bits/stl_algobase.h:66:0,
from /usr/include/c++/6/deque:60,
from /usr/include/c++/6/queue:60,
from /in/foo.cc:4:
/usr/include/c++/6/bits/stl_iterator_base_funcs.h:205:5: note: template<class _ForwardIterator> _ForwardIterator std::next(_ForwardIterator, typename std::iterator_traits<_Iter>::difference_type)
next(_ForwardIterator __x, typename
^~~~