white-collar

White Collar

Problem Statement:

Jacob’s friend Victor likes to watch soap ‘White Collar’ .An intriguing episode is about to start, and he hasn't scrubbed his plate yet .So he ultimately decided to at least put it under the tap to be filled with water .The plate can be represented by a parallelepiped n×p×q, i.e, it has n  layers (the last layer is the bottom one and the first layer is the upper one), each of which is a rectangle of  p × q with empty squares ('.') and blockades ('#'). However the water can only be present in the empty squares. Victor positioned the tap in a way such that it is above the square (x,y) of the first layer (assume that this square(x, y) is empty). In every minute a cubical unit of water from the tap falls into the plate. Your task is to find out in exactly how many minutes should victor unglue himself from the soap White Collar and turn the water off for it not to overfill the plate. That is, you should find the moment of time when the plate is completely full and is about to overfill in the next moment.

Note: The water fills all the area within reach (see test case 4). Water flows in each of the 6 directions/faces of the given cube with dimension 1 x 1 x 1.

Input : 

The first line contains T – No of test cases (1 ≤ T ≤ 25).

Next T lines contain three numbers n, p, q (1 ≤ n, p, q ≤10) which are the sizes of the plate. Then follow n rectangles where each rectangle consist of p lines each containing q characters either '.' or '#', which represents the "layers" of the plate in that order from the top to the bottom. The rectangles are separated by empty lines (see the sample test cases). The last line contains x and y (1 ≤ x ≤ p,1 ≤ y ≤ q) which are the tap's coordinates. x is the number of the row and y is the number of the column. Rows of each layer are numbered from left to right by the integers from 1 to p and columns of each layer are numbered from top to bottom by the integers from 1 to q.

Output :

T lines of output should contain an integer, showing exactly in how many minutes the plate will be filled completely with water.

SAMPLE INPUT
5
1 1 1

.

1 1
2 1 1

.

#

1 1
2 2 2

.#
##

..
..

1 1
3 2 2

#.
##

#.
.#

..
..

1 2
3 3 3

.#.
###
##.

.##
###
##.

...
...
...

1 1

SAMPLE OUTPUT
1
1
5
7
13

Source: hackerearth | Difficulty: UNKNOWN_DIFFICULTY


Solutions: