Help -Starter: Rated for div-3 getting WA

I am getting WA fot this question . I think its a simple BFS implementation.
Here is the question. please help me to point out mistake in my approach. Here is my solution.