Getting WA on Special Shortest Walk (SPSHORT)

Hello, can somebody please tell me why my code is giving WA?
Problem: SPSHORT Problem | CodeChef
My code: CodeChef | Competitive Programming | Participate & Learn