Rat in a maze problem | Python solution | Reach last row of any column