import Control.Monad (replicateM) import Data.List (elemIndex) import Data.Maybe (fromJust) transpose :: [[a]] -> [[a]] transpose ([]:_) = [] transpose xs = map head xs : transpose (map tail xs) solve :: [[String]] -> Int solve ns | isrentyon = succ $ fromJust $ elemIndex True r | otherwise = -1 where r = map (all f) ys f s = s == "nyanpass" || s == "-" ys = transpose ns isrentyon = (length . filter (==True)) r == 1 main = do n <- readLn ns <- map words <$> replicateM n getLine print $ solve ns