import Data.List (transpose, elemIndices) findRenchon :: [[String]] -> Int findRenchon xs | length cands == 1 = head cands | otherwise = -1 where cands = map (+ 1) $ elemIndices (length xs - 1) $ map (length . elemIndices "nyanpass") xs main :: IO () main = getLine >> getContents >>= print . findRenchon . transpose . map words . lines