#include <bits/stdc++.h>

#define ll long long

using namespace std;

int t;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> t;
    while (t--) {
        int n;
        cin >> n;
        vector<pair<int, int> > a(n + 1);
        for (int i = 1; i <= n; i++) {
            cin >> a[i].first;
            a[i].second = i;
        }
        sort(a.begin() + 1, a.end());
        if (a[1].first == a[2].first) {
            cout << a[n].second << endl;
        } else {
            cout << a[1].second << endl;
        }
    }

    return 0;
}