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;
inline bool isdigit(char& ch) { return ch >= '0' && ch <= '9'; }
template <class T>
void read(T& x) {
  x = 0;
  long long f = 1;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getchar()) x = (x << 1) + (x << 3) + ch - '0';
  x *= f;
}
template <class T>
inline void write(T x) {
  if (x == 0) {
    putchar('0');
    return;
  }
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  int _stk[65], _top = 0;
  for (; x; x /= 10) _stk[++_top] = x % 10 + 48;
  for (; _top; _top--) putchar(_stk[_top]);
}
const int MAXN = 3e5 + 10;
int t;
int arr[MAXN];
int len[MAXN];
int main() {
  int n;
  read(t);
  while (t--) {
    read(n);
    stack<int> stk;
    for (int i = (int)(1); i < (int)(n + 1); i++) {
      read(arr[i]);
      len[i] = 0;
    }
    for (int i = (int)(1); i < (int)(n + 1); i++) {
      if (stk.empty()) {
        stk.push(i);
        continue;
      }
      if (arr[i] + len[i] > arr[stk.top()] + len[stk.top()]) {
        len[i] = len[stk.top()] + 1;
        stk.pop();
        stk.push(i);
      } else if (arr[i] + len[i] < arr[stk.top()] + len[stk.top()]) {
        len[stk.top()]++;
      } else {
        stk.push(i);
      }
    }
    while (stk.size() >= 2) {
      int s1 = stk.top();
      stk.pop();
      int s2 = stk.top();
      stk.pop();
      if (arr[s2] + len[s2] > arr[s1] + len[s1]) {
        len[s2] = len[s1] + 1;
        stk.push(s2);
      } else if (arr[s2] + len[s2] < arr[s1] + len[s1]) {
        len[s1] = len[s2] + 1;
        stk.push(s1);
      } else {
        stk.push(s1);
        stk.push(s2);
        break;
      }
    }
    if (stk.size() != 1) {
      write(-1);
      putchar('\n');
    } else {
      write(stk.top());
      putchar('\n');
    }
  }
  return 0;
}
