1
3
5 3 4
 6
5
5 3 4 4 5
3
1 1 1
5
4 4 3 4 4
5
5 5 4 3 2
3
1 1 2
5
5 4 3 5 5
 1
3
10 1 5

1
 1
-1
2
2
3
1
 1

#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int t;
  cin >> t;
  while (t--) {
    int n, i;
    cin >> n;
    vector<pair<int, int> > a(n);
    for (i = 0; i < n; i++) {
      cin >> a[i].first;
      a[i].second = i + 1;
    }
    sort(a.begin(), a.end());
    if (a[0].first == a[n - 1].first)
      cout << "-1\n";
    else {
      vector<pair<int, int> > diff;
      vector<pair<int, int> >::iterator it = a.end(), itt;
      it--;
      itt = it - 1;
      for (; it->first == itt->first; it--, itt--) {
        diff.push_back({it->second - itt->second, it->second});
      }
      if (diff.empty())
        cout << it->second << "\n";
      else {
        sort(diff.begin(), diff.end());
        it = diff.end();
        it--;
        itt++;
        if (it->second == n)
          cout << itt->second << "\n";
        else
          cout << it->second << "\n";
      }
    }
  }
  return 0;
}
