思维
#include <bits/stdc++.h>
using i64 = long long;
void solve() {
int n;
std::cin >> n;
std::vector<int> a(n);
for (int i = 0; i < n; i ++) {
std::cin >> a[i];
}
int l = 0, r = n - 1, vl = 1, vr = n;
while (l <= r) {
if (a[l] == vl) {
l ++;
vl ++;
} else if (a[l] == vr) {
l ++;
vr --;
} else if (a[r] == vl) {
r --;
vl ++;
} else if (a[r] == vr) {
r --;
vr --;
} else {
break;
}
}
if (l <= r) {
std::cout << l + 1 << " " << r + 1 << "\n";
} else {
std::cout << -1 << "\n";
}
}
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int t;
std::cin >> t;
while (t --) {
solve();
}
return 0;
}