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

// Function to find minimum range
// increments to sort an array
int findTheOnlyDifferent(int arr[], int n)
{
    // Array size must be at least two.
    if (n == 1)
        return -1;

    // If there are two elements, then we
    // can return any one element as different
    if (n == 2)
        return 1;

    // Check if the different element is among
    // first three
    if (arr[0] == arr[1] && arr[0] != arr[2])
        return 3;
    if (arr[0] == arr[2] && arr[0] != arr[1])
        return 2;
    if (arr[1] == arr[2] && arr[0] != arr[1])
        return 1;

    // If we reach here, then first three elements
    // must be same (assuming that only one element
    // is different.
    for (int i = 3; i < n; i++)
        if (arr[i] != arr[i - 1])
            return i+1;

    return -1;
}

// Driver Code
int main()
{
    int t;
    cin>>t;
    while(t--){
            int n;
    cin>>n;
    int arr[n];
    for(int i=0;i<n;i++)
        cin>>arr[i];

    cout << findTheOnlyDifferent(arr, n)<<endl;
    }
    return 0;
}
