/in/foo.cc: In function 'void pre()':
/in/foo.cc:34:5: error: reference to 'next' is ambiguous
next[i][j][k]=make_pair(x,y);
^~~~
/in/foo.cc:17:5: note: candidates are: std::pair<int, int> next [51][51][4]
pii next[N][N][4];
^~~~
In file included from /usr/include/c++/6/bits/stl_algobase.h:66:0,
from /usr/include/c++/6/bits/char_traits.h:39,
from /usr/include/c++/6/ios:40,
from /usr/include/c++/6/ostream:38,
from /usr/include/c++/6/iostream:39,
from /in/foo.cc:1:
/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
^~~~
/in/foo.cc: In function 'void BFS()':
/in/foo.cc:56:12: error: reference to 'next' is ambiguous
pii nxt=next[now.x][now.y][k];
^~~~
/in/foo.cc:17:5: note: candidates are: std::pair<int, int> next [51][51][4]
pii next[N][N][4];
^~~~
In file included from /usr/include/c++/6/bits/stl_algobase.h:66:0,
from /usr/include/c++/6/bits/char_traits.h:39,
from /usr/include/c++/6/ios:40,
from /usr/include/c++/6/ostream:38,
from /usr/include/c++/6/iostream:39,
from /in/foo.cc:1:
/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
^~~~