I am getting runtime error at testcase 32 but can't find where the problem is

PROBLEM LINK : CodeChef
my submission : Solution: 65531767 | CodeChef
can someone please help me with that ?

Check the following implementation of BFS.

Accepted 1

The following is also another possible implementation of BFS.

Accepted 2