Turkey Coop Maze The local turkey farm is building a multistoried coop to hold many more turkeys. To raise money for the unfinished coop, they are selling tickets for the following game. The coop looks like a 3D grid of cages. Some cages are built but some are not. You start in a designated start spot in the grid and have to reach the designated finish point in the least number of steps. A step is a move one unit north, south, east, west, up or down. You cannot move diagonally and the coop is surrounded by solid walls on all sides. To simplify the problem assume each cage is a unit cube. You can travel through an unfinished cage but not a finished one. It takes 1 minute to move one step. Is it possible to successfully finish the game? If yes, how long will it take? Input The input file consists of a number of coops. Each coop description starts with a line containing three integers L, R and C (all limited to 30 in size). L is the number of levels in the coop. R and C are the number of rows and columns in each level of the grid (coop). Then there will follow L blocks of R lines each containing C characters. Each character describes one point of the grid. A cage that is complete is indicated by a `#' and incomplete cages are represented by a `.'. Your starting position is indicated by `S' and the exit by the letter 'E'. There's a single blank line after each level. Input is terminated by three zeroes for L, R and C. Output Each coop generates one line of output. If it is possible to reach the finish point, print a line of the form Escaped in x minute(s). where x is replaced by the shortest time it takes to escape. If it is not possible to escape, print the line Trapped! Sample Input 3 4 5 S.... .###. .##.. ###.# ##### ##### ##.## ##... ##### ##### #.### ####E 1 3 3 S## #E# ### 0 0 0 Sample Output Escaped in 11 minute(s). Trapped!