The first line contains an integer $n (2 ≤ n ≤ 1 000)$ — the size of the hangar floor. Each of the following $n$ lines contains a string of exactly $n$ characters describing one row of the floor. The character # denotes a blocked cell while the character . denotes an empty cell.
The following line contains an integer $q (1 ≤ q ≤ 300 000)$ — the number of queries. The $k$-th of the following $q$ lines contains four integers $r_{A_k} , c_{A_k} , r_{B_k} , c_{B_k} (1 ≤ r_{A_k} , c_{A_k} , r_{B_k} , c_{B_k} ≤ n)$ — the row number and column number of cells $A_k$ and $B_k$ respectively. Cell $A_k$ will be different than the cell $B_k$. Also, both cells will always be empty.
Output $q$ lines. The $k$-th line should contain a single integer $s_k$ — the size of the largest crate that can be moved from $A_k$ to $B_k$ . If no crate can be moved from $A_k$ to $B_k$ then $s_k$ should be $0$.