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;
signed main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n, mn = 1000000001, mx = 0, nmn = 0, bl = -1, bp = 0;
    cin >> n;
    long long a[n];
    for (long long i = 0; i < n; i++) cin >> a[i];
    for (long long i = 0; i < n; i++)
      if (a[i] < mn) {
        mn = a[i];
        nmn = i;
      }
    for (long long i = 0; i < n; i++)
      if (a[i] > mx) mx = a[i];
    for (long long i = nmn; i < n; i++)
      if (a[i] == mx) {
        bp = i;
        break;
      }
    for (long long i = nmn; i >= 0; i--)
      if (a[i] == mx) {
        bl = i;
        break;
      }
    if (mn == mx)
      cout << -1 << endl;
    else {
      if (bp == 0)
        cout << bl + 1 << endl;
      else if (bl == -1)
        cout << bp + 1 << endl;
      else {
        if (nmn - bl >= bp - nmn)
          cout << bp + 1 << endl;
        else
          cout << bl + 1 << endl;
      }
    }
  }
}
