Rat in a maze problem

my code is showing wrong answer for test case number:3 only but i am unable to find bug in it

link to my code :

@soorya19k read output format of the problem,
If solution doesn't exist, just print "-1". you have not considered this case