foldmap :: (b -> a -> b) -> b -> [a] -> [b]
foldmap _ i [] = [i]
foldmap f i (x:xr) = i:(foldmap f (f i x) xr)

dp :: [Int] -> [Int] -> Int -> [Int]
dp [] [] _ = []
dp (x:xr) (y:yr) s
  |y == 0 = 0:dp xr yr 0
  |otherwise = ((min s x) + 1) : dp xr yr (min ((min s x) + 1) x)

maxFactor :: [Int] -> Int
maxFactor [x] = x
maxFactor (x:xr) = max x (maxFactor xr)

solve :: Int -> [String] -> Int
solve size input =(maxFactor (map maxFactor $ foldmap (\lA lB -> (dp lA lB 0)) (take size (repeat 0)) (map (\c -> map (\char -> if (char == '.') then 1 else 0) c) input)))

endZeroLoop :: [String] -> [Int]
endZeroLoop [x] = []
endZeroLoop (x:xr) = (solve size (take size xr)) : (endZeroLoop (drop size xr))
  where size = (read x)::Int

main = do
  stdin <- getContents
  --let input = lines stdin
  mapM_ print (endZeroLoop (lines stdin))