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;
  while (t--) {
    int n;
    cin >> n;
    int k[n];
    int maxv[2] = {-2147483648, 0};
    int endv[2] = {-2147483648, 0};
    bool flag = false;
    for (int i = 0; i < n; i++) {
      cin >> k[i];
      if (maxv[0] < k[i]) {
        maxv[0] = k[i];
        maxv[1] = i;
      }
      if (endv[0] <= k[i]) {
        endv[0] = k[i];
        endv[1] = i;
      } else {
        flag = true;
      }
    }
    if (flag) {
      cout << -1;
    } else {
      if (maxv[1] != 0 || maxv[1] == endv[1]) {
        cout << maxv[1];
      } else {
        cout << endv[1];
      }
    }
    cout << endl;
  }
  return 0;
}
