{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"\n \u003cdiv class\u003d\"ptx\" lang\u003d\"en-US\"\u003e\n\u003cp\u003eAnton is an adventurous person. Now he is trapped in a perplexing 3D maze. Due to the air is damp crisp, he has to find a quickest way out. The 3D maze is made up of unit cubes. Some cubes are filled with snakes while others are not. Snakes!!! It will take one minute to take a unit move. He can choose to go north, south, east, west, up or down, but he cannot move diagonally.\n \u003cbr\u003e \n \u003cbr\u003eIs an escape possible? If yes, how long will it take? \n \u003cbr\u003e\n \u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\n \u003cdiv class\u003d\"ptx\" lang\u003d\"en-US\"\u003e\n The input contains a number of 3D mazes. Each description of maze starts with a line containing three integers L, R and C (L, R, C \u003c\u003d 30). \n \u003cbr\u003eL: The number of levels makes up the maze. \n \u003cbr\u003eR and C: The number of rows and columns maks up the plane of each level. \n \u003cbr\u003eThen there will follow L blocks of R lines, and each containing C characters. Each character describes one cube of the maze. A cube full of snakes is indicated by a \u0027#\u0027 and empty cubes are represented by a \u0027.\u0027. Your starting position is indicated by \u0027S\u0027 and the exit by the letter \u0027E\u0027. There\u0027s a single blank line after each level. The Input terminates when L \u003d R \u003d C \u003d 0. \n \u003c/div\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\n \u003cdiv class\u003d\"ptx\" lang\u003d\"en-US\"\u003e\n Each maze generates one line of output. If it is possible to reach the exit, output a line of the form: \n \u003cbr\u003e\n \u003cblockquote\u003e\n Escaped in x minute(s). \n \u003c/blockquote\u003e \n \u003cbr\u003ewhere x is replaced by the shortest time it takes to escape. \n \u003cbr\u003eIf it is not possible to escape, output the line:\n \u003cbr\u003e\n \u003cblockquote\u003e\n Trapped! \n \u003c/blockquote\u003e\n \u003c/div\u003e"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre class\u003d\"sio\"\u003e3 4 5\nS....\n.###.\n.##..\n###.#\n\n#####\n#####\n##.##\n##...\n\n#####\n#####\n#.###\n####E\n\n1 3 3\nS##\n#E#\n###\n\n0 0 0\n\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre class\u003d\"sio\"\u003eEscaped in 11 minute(s).\nTrapped!\n\u003c/pre\u003e"}}]}