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;
void solve() {
  int n, a;
  cin >> n;
  vector<int> v;
  v.push_back(-1);
  set<int> st;
  for (int i = 1; i <= n; i++) cin >> a, v.push_back(a), st.insert(a);
  if (st.size() == 1) {
    cout << -1 << endl;
    return;
  }
  int mx = 0, mxi = 0;
  for (int i = 2; i <= n; i++) {
    if (v[i] > v[i - 1]) {
      cout << i << endl;
      return;
    }
    if (v[i] < v[i - 1]) {
      cout << i - 1 << endl;
      return;
    }
  }
}
int main() {
  int tc = 1;
  cin >> tc;
  while (tc--) solve();
}
