Getting 2 testcases wrong

can anyone please tell me whats wrong with my code i am failing 2 testcases.
problem :- piyush and magical park

@Usha24 you have taken variable m as your row and n as your column but everywhere you are using n as your row and m as your column.Change this and you are good to go.

@Usha24 mark this doubt as resolved if you don’t have any further queries.