sherlock grid

I want to know for which test case my code fails?

http://www.codechef.com/viewsolution/4885423