#include<bits/stdc++.h>
using namespace std;
//upper_bound(begin(),end(),key)
//lower_bound(begin(),.end(),key)
//fractional = modf(n, &whole);
// next_permutation(arr[i].begin(),arr[i].end())
//transform(s.begin(),s.end(),s.begin(),::tolower)
//*max_element(ans.begin(),ans.end())
// stringstream geek(s); ll x=0; geek>>x; cout<<x;
// stringstream ss;  ss<<a;  string s;  ss>>s;  cout<<s;
// gcd(a+k,b+k)=gcd(b−a,a+k)
#define make0(x) memset(x,0,sizeof(x));
#define make1(x) memset(x,-1,sizeof(x));
#define ll long long
#define pb push_back
#define open freopen("input.txt","r",stdin);
#define close freopen("output.txt","w",stdout);
#define modd 1000000007
#define rep(i,a,n)  for(i=a;i<n;i++)
#define repn(i,n,a) for(i=n;i>=a;i--)


int main()
{ int t,i,j;
  cin>>t;
  rep(i,0,t)
  { int n;
    cin>>n;
    map<int,int> m;
    vector<int> v;
    vector<int>::iterator it;
    set<int> s;
    set<int>::iterator itr;
    int ans;
    rep(j,0,n)
    { int a;
      cin>>a;
      v.pb(a);
      s.insert(a);
      m[a]++;
      if(m[a]>1)
        ans=a;
    }
    s.erase(ans);
    itr=s.begin();
    it=find(v.begin(),v.end(),*itr);
    cout<<it-v.begin()+1<<"\n";
  }


  return 0;
}
