Why am I getting an NZEC in this problem: TRINDIA2 [python3.5]?

Here’s my solution: Link to my code.

It works on the sample input given. I don’t think the list indices are going out of range.

//