Subarray GCD WA

def gcd(a,b):
while b:
b,a=a%b,b
return a==1
for t in range(int(raw_input())):
n=int(raw_input())
a=map(int,raw_input().split())
x=max(a)
f=True
for i in a:
if gcd(x,i):
print n
f=False
break
if f:
print -1

//