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;
    vector<int> arr;
    for (int i = 0; i < N; i++) {
      int temp;
      cin >> temp;
      arr.push_back(temp);
    }
    int max = *max_element(arr.begin(), arr.end());
    int coun = count(arr.begin(), arr.end(), max);
    if (coun == N) {
      cout << "1" << endl;
      continue;
    }
    int index = find(arr.begin(), arr.end(), max) - arr.begin();
    if (coun == 1) {
      cout << index + 1 << endl;
      continue;
    }
    int min = *min_element(arr.begin(), arr.end());
    int index1 = find(arr.begin(), arr.end(), min) - arr.begin();
    int i = 0;
    for (i = index1; i < N; i++) {
      if (arr[i] == max) break;
    }
    if (i != index1) {
      cout << i + 1 << endl;
      continue;
    }
    for (i = index1; i >= 0; i--) {
      if (arr[i] == max) break;
    }
    if (i != index1) {
      cout << i + 1 << endl;
      continue;
    }
  }
}
