Rat in a maze Problem

1 test case is not passing and one test case is giving TLE

u are required to only print 1 possible solution also take 2d array size as 1001