Matrix Search challenge

Hi, I have written the code and its showing correct output for some input i put in but when i submit it, its showing run time error and i cant figure out why?

Plz send your code by saving on ide, so that I could check it