Why i am getting NZEC error in python program

I wrote this program
T=input()
if 1<=int(T)<=10:
for i in range(int(T)):
N=input()
if 1<=int(N)<=100000:
x=input().split()
if len(x)==int(N):
if 1<=int(max(x))<=1000000:
x=[int(y) for y in x]
x=sorted(x)
print (x[len(x)-1]-x[0])
else:break
else:break
else:break
else:print(‘break’)

but i am getting NZEC error repeatedly, what should i do, i am new to python and new to codechef.thanks

please post your code in proper blocks.

Post it as a code, not as text. This is unreadable.