import java.util.Scanner object Problem239 { def main(args: Array[String]) { val sc = new Scanner(System.in) val N = sc.nextInt val said = List.fill(N, N)(sc.next) val transposeSaid = said.transpose.zip(Stream from 1) val rentyonppoiMember = transposeSaid.filter(_._1.forall(say => say == "nyanpass" || say == "-")) val tokutei = rentyonppoiMember.length == 1 if (tokutei) { println(rentyonppoiMember.head._2) } else { println(-1) } } }