I wrote the following python code for this problem. I dont know why it shows a wrong answer. I tried to cover all the edge test cases like all 1’s and 1 even , all 1’s and 1 odd (except 1) and 1 even. Plz tell me if there is a particular test case where it fails
# cook your dish here
import math
def checkprime(k):
if k==3: return 0
else:
for i in range(2,int(math.sqrt(k))+1):
if k%i==0:
return 1
return 0
for _ in range(int(input())):
n=int(input())
a=list(map(int,input().split()))
odd=[]
even=[]
one=-1
for i in range(len(a)):
if a[i]%2==0:
even.append(i+1)
if len(even)==2:
print(*even)
break
elif a[i]%2!=0 :
if a[i]==1 and one==-1:
odd.append(i+1)
one=1
elif a[i]!=1:
odd.append(i+1)
if len(odd)==2:
print(*odd)
break
else:
if one==-1:
if checkprime(a[0]+a[1]):
print(1,2)
else: print(-1)
else:
if even==[]: print(-1)
else:
if checkprime(a[even[0]-1]+1):
print(one,even[0])
else: print(-1)