rat in a maze problem

1 represents path, 0 represents block, 9 represents cheese.

we need to print 1 if there exists a path to cheese starting from (0,0).

I have coded in python, it is giving runtime error. Please help.

Code link - Python Code

//