import std.stdio, std.conv, std.string, std.range, std.math, std.algorithm; void main() { auto N = readln.strip.to!int; auto A = stdin.byLineCopy.map!split.array; int[] ans; foreach (j; 0 .. N) { int count; foreach (i; 0 .. N) { if (A[i][j] == "nyanpass") count++; } if (count == N - 1) ans ~= j + 1; } (ans.length == 1 ? ans.front : -1).writeln; }