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() {
  int t;
  cin >> t;
  for (int i = 0; i < t; i++) {
    int n;
    cin >> n;
    int a[n], max = 0, pmax, el1, f = 0;
    cin >> a[0];
    el1 = a[0];
    for (int j = 1; j < n; j++) {
      cin >> a[j];
      if (a[j] != el1) {
        f = 1;
      }
      if (a[j] >= max) {
        max = a[j];
        pmax = j;
      }
    }
    int f2 = 0;
    for (int j = pmax; j > -1; j--) {
      if (a[j] != max) {
        f = 1;
      }
    }
    if (f == 1 && ((f2 == 1) || pmax != n))
      cout << pmax << endl;
    else {
      cout << -1 << endl;
    }
  }
}
