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

#define fr first
#define sc second
#define be begin()
#define en end()
#define pb push_back
#define pp pair<int,int>
#define quick ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
   
typedef long long ll;
   
const int INF = 1e9, SIZE = 1e6 + 10, MOD = 1e9 + 7;

int main(){
  
    //ifstream cin("input.txt");
   
    quick;
      
    int test;
    cin >> test;

    while (test--){
        int n, in = -1;
        cin >> n;
        int a[n];
        for (int i = 0; i < n; ++i)
            cin >> a[i];
        for (int i = 1; i < n-1; ++i){
            if (a[i] != a[i - 1] && a[i] != a[i + 1])
                in = i;
        }
        if (in == -1){
            if (a[1] != a[0])
                in = 0;
            else in = n - 1;
        }
        cout << in + 1 << endl;
    }

    return 0;
}