// Problem: C. Dora and Search
// Contest: Codeforces - Codeforces Round #852 (Div. 2)
// URL: https://codeforces.com/contest/1793/problem/C
// Memory Limit: 256 MB
// Time Limit: 1000 ms
//
// Powered by CP Editor (https://cpeditor.org)
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define pb push_back
#define vi vector<int>
#define pii pair<int, int>
#define pll pair<long long, long long>
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int getRand(int l, int r)
{
uniform_int_distribution<int> uid(l, r);
return uid(rng);
}
const int p = 1e9 + 7;
const int lim = 2e5+5;
void solve(){
int n;
cin>>n;
int a[n];
int mn=1,mx=n;
for(int i=0;i<n;i++){
cin>>a[i];
}
int p=0;
int l=0,r=n-1;
while(l<r){
if(a[l]!=mn&&a[l]!=mx&&a[r]!=mn&&a[r]!=mx){p=1;cout<<l+1<<" "<<r+1<<endl;break;}
if(a[l]==mn){mn++;l++;}
else if(a[l]==mx){mx--;l++;}
if(a[r]==mn){mn++;r--;}
else if(a[r]==mx){mx--;r--;}
}
if(p==0)cout<<-1<<endl;;
}
int32_t main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);cout.tie(NULL);
int t;
cin>>t;
while(t--){
solve();}
}
1438A - Specific Tastes of Andre | 1711C - Color the Picture |
1194C - From S To T | 110B - Lucky String |
1114A - Got Any Grapes | 224B - Array |
125B - Simple XML | 567B - Berland National Library |
431B - Shower Line | 282C - XOR and OR |
1582B - Luntik and Subsequences | 609A - Флеш-карты |
1207A - There Are Two Types Of Burgers | 371C - Hamburgers |
343B - Alternating Current | 758B - Blown Garland |
1681B - Card Trick | 1592A - Gamer Hemose |
493D - Vasya and Chess | 1485A - Add and Divide |
337B - Routine Problem | 1392D - Omkar and Bed Wars |
76E - Points | 762C - Two strings |
802M - April Fools' Problem (easy) | 577B - Modulo Sum |
1555B - Two Tables | 1686A - Everything Everywhere All But One |
1469B - Red and Blue | 1257B - Magic Stick |