#include using namespace std; int main() { int N; cin >> N; vector V(N); string s; for (int i = 0; i < N; i++) for (int j = 0; j < N && cin >> s; j++) if (s != "nyanpass" && s != "-") V.at(j)++; int ans = 0, cnt = 0; for (int i = 0; i < N; i++) if (!V.at(i)) ans = i + 1, cnt++; cout << ((cnt == 1) ? ans : -1) << "\n"; }