NZEC for no reason in Python DDISH problem

I have submitted a working solution to the DDISH problem.
It is written in Python and it keeps getting an NZEC error though I have checked the following things:

  1. Value too long for int in Python: Within the range
  2. Input/Output format: I have verified with the < in.txt > out.txt check
  3. I have also put in the __name__ == '__main__' check

It is really frustrating. Please can anyone point out the error.
The link to my submission is: solution.

//