WA : Game Of Robots

Problem : https://www.codechef.com/problems/ROBOGAME

My Solution : https://www.codechef.com/viewsolution/21682918

I tried a lot of test-cases manually , And it worked pretty well for those ; I cannot figure out the mistake , Please Help
!

Try test case

0…3

Your code prints unsafe while correct answer is safe.

Oh Thanks @taran_1407

//