Bfs shortest path


by this code im getting all the test cases right for this question but a same ques is there in hackerblocks just input scenario is changing i have changed that but im getting 1 test case wrong why?
https://hack.codingblocks.com/app/practice/1/6/problem
this is the question

@deepakjumani09

If there is no solution, print -1.

you forgot this

in snake and ladder game i can take more chances but at last i will reach its always possible to reach