The first line of input contains an integer T(T100) denoting the number of case. Each case has five integers L(1L10), H(1H100), W(1W100), N(1N100) and S(1S10, 000) denoting the number of floors, height and weight of each floor, the number of unconscious people, and the given time respectively.
The next L blocks describe the map of each floor from the 1st floor to the L-th floor respectively. Each floor consists of H lines each contains W characters. Characters that may appear in each floor are:
- ``S" : The starting point, also serves as the exit point. There will be only one starting/exit point and it will appear in the first floor.
- ``X" : Obstacle, cell that cannot be visited (wall, fire, etc.).
- ``U" : Stair that connect to the upper floor. There will be a ``D" character at the same place in the upper level. This character will not appear in the highest level of the building.
- ``D" : Stair that connect to the lower floor. There will be a ``U" character at the same place in the lower level. This character will not appear in the lowest level of the building.
- ``." : Empty space, cell that can be visited.
The next N lines each contains four integers fi(1fiL), ri(1riH), ci(1ciW), pi(1pi1, 000) denoting the location of each volunteer (floor, row, column) and the point assigned to this volunteer respectively. You can assume that each volunteer will be located in empty space and no two volunteer occupy the same location.