open System type Sol() = member this.Solve() = let N = stdin.ReadLine() |> int let S = Array.zeroCreate N for i = 0 to (N-1) do S.[i] <- stdin.ReadLine().Split(); let checkRenchon (s :string [] []) j = let mutable chk = true for i=0 to (N-1) do if i <> j then (chk <- (chk && (s.[i].[j] = "nyanpass" ))) chk let mutable cnt = 0 let mutable idx = -1 for i = 0 to (N-1) do match (checkRenchon S i) with | true -> (cnt <- (cnt + 1) ;idx <- (i+1)) | false -> () printfn "%d" (if cnt = 1 then idx else -1) let mySol = new Sol() mySol.Solve()