using System; using System.Linq; using System.Collections.Generic; using System.Text; namespace Solver { interface Output { void Write(object str); void WriteLine(object str); } interface Input { int NextInt(); string NextString(); } class Console_ : Input, Output { Queue param = new Queue(); int Input.NextInt() { if (param.Count == 0) { foreach (var item in Console.ReadLine().Split(' ')) { param.Enqueue(item); } } return int.Parse(param.Dequeue()); } string Input.NextString() { if (param.Count == 0) { foreach (var item in Console.ReadLine().Split(' ')) { param.Enqueue(item); } } return param.Dequeue(); } void Output.Write(object obj) { System.Console.Write(obj); } void Output.WriteLine(object obj) { System.Console.WriteLine(obj); } } class Program { static void Main(string[] args) { new Solver(new Console_(), new Console_()).Run(); } } class Debug_ : Input { int i = 0; int Input.NextInt() { return (int)data[i++]; } string Input.NextString() { return (string)data[i++]; } object[] data = { 1, 2, 2, 2 }; } class Solver { Input input; Output output; public Solver(Input input, Output output) { this.input = input; this.output = output; } public void Run() { int N = input.NextInt(); var greeting = Enumerable.Repeat(true, N).ToArray(); for (int i = 0; i < N; ++i) { for (int j = 0; j < N; ++j) { var str = input.NextString(); greeting[j] &= (str == "nyanpass" || str == "-"); } } int ren = -1; for (int i = 0; i < N; ++i) { if (greeting[i]) { if (ren == -1) { ren = i + 1; } else { output.WriteLine(-1); return; } } } output.WriteLine(ren); } } }