#include<bits/stdc++.h>
using namespace std;


int main()
{
    int test;
    cin>>test;
    while(test--)
    {
        int n,ans;
        cin>>n;
        int arr[n];
        for(int i=0;i<n;i++)
        {
            cin>>arr[i];
        }
        for(int i=0;i<n-2;i++)
        {
            if(arr[i]!=arr[i+1] && arr[i+1]==arr[i+2])
            {
                ans=i+1;
                break;
            }
            else if(arr[i]!=arr[i+1] && arr[i+1]!=arr[i+2])
            {
                ans=i+2;
                break;
            }
            else if(arr[i]==arr[i+1] && arr[i+1]!=arr[i+2])
            {
                ans=i+3;
                break;
            }
            else
            continue;
        }
        cout<<ans<<endl;

    }
    
    return 0;
}