https://www.codechef.com/LTIME89B/problems/COPAR

And i also want to mention i have seen the python code also with this logic getting AC.

code in cpp:

```
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
using namespace std;
int gcd(int a,int b){
if (a == 0)
return b;
if(b==0)
return 0;
return gcd(b % a, a);
}
int d(vector<int> a,int j,int n){
int x=1;
for(int i=j;i<n;i++)
x=(x*a[i]);
return x;
}
int solve(vector<int> a,int n){
for(int i=0;i<n-1;i++){
int l=d(a,0,i+1),r=d(a,i+1,n);
if(gcd(l,r)==1){
return i+1;
}
}
return -1;
}
int32_t main(){
#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
#endif
int t;
cin>>t;
while(t--){
int n;
cin>>n;
vector<int>a(n);
rep(i,0,n)
cin>>a[i];
int x=solve(a,n);
if(x!=-1)
cout<<x<<'\n';
}
}
```

code in python:

```
def prod(myList) :
result = 1
for x in myList:
result = result * x
return result
def d(a, b):
if a == 0:
return b
return d(b % a, a)
def L(n, seq):
for i in range(n-1):
a = prod(seq[:i+1])
b = prod(seq[i+1:])
if d(a, b) == 1:
return i + 1
else:
continue
T = int(input())
for _ in range(T):
n = int(input())
sequence = list(map(int, input().split()))
print(L(n, sequence))
```