module Main where import Control.Monad import Data.List (transpose) main :: IO () main = do n <- readLn xss <- fmap transpose . replicateM n $ words <$> getLine let f x = if (x == "-" || x == "nyanpass") then True else False let ys = filter ((all f) . snd) $ zip [1..] xss if length ys == 1 then print $ fst $ head ys else print (-1)