Contest 5 chef and squares

cook your dish here

t=int(input())
for j in range(t):
n=int(input())
f=0
if n==1:
print(-1)
else:
i=1
while(ii<=n):
if (n-i
i)%(2i)==0:
f=1
x=(n-i
i)//(2*i)
print((i+x)**2-n)
break
else:
i+=1
if f==0:
print(-1)
can anyone tell me whats wrong?
sample cases passes