#include <iostream>
#include <string>
#include <map>

using namespace std;

int main(){
    int n, t, a[100001];
    cin >> t;
    map <string, int> m;
    for (int i = 0; i < t; i ++){
        cin >> n;
        for (int c = 0; c < n; c ++){
            cin >> a[c];
        }
        for (int j = 0; j < n - 1; j ++){
            if (a[j] != a[j + 1]){
                if (j == (n - 1)){
                    if (a[j - 1] != a[j + 1]){
                        cout << j + 2 << endl;
                        break;
                    }
                    else{
                        cout << j + 1 << endl;
                        break;
                    }
                }
                else{
                    if (a[j + 2] != a[j + 1]){
                        cout << j + 2 << endl;
                        break;
                    }
                    else{
                        cout << j + 1 << endl;
                        break;
                    }
                }
            }

        }
    }
}
