RRJOKE - Getting an NZEC Error on my code.

Why am I getting an NZEC for the following python code. It should work fine. I am new to this and trying to get better. Please tell me if i made mistakes in the code itself, thanks.
for t in range(input()):
n=input()
for i in range(n):
a=input()
result=0
for i in range(n+1):
result^=i
print (result)

The range function takes integer as an argument and input by default takes string as an input, so make sure you type cast input function inside range function. Rest everything is fine.
The corrected code is:


for t in range(int(input())): 
	n=int(input()) 
	for i in range(n): 
		a=input() 
	result=0 
	for i in range(n+1): 
		result^=i 
	print (result)