#include <bits/stdc++.h>
using namespace std;

#define fast_io ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define int long long
#define endl '\n'

int32_t main(){
    fast_io;

    int t;
    cin>>t;

    while(t--){
        int n;
        cin>>n;

        vector<int>a(n);
        unordered_map<int,int> f;

        for(int i=0;i<n;i++){
            cin>>a[i];
            f[a[i]]++;
        }

        int l=-1,r=-1;
        int best=0;

        int i=0;
        while(i<n){
            if(f[a[i]]!=1){
                i++;
                continue;
            }

            int j=i;
            while(j<n && f[a[j]]==1) j++;

            if(j-i>best){
                best=j-i;
                l=i+1;
                r=j;
            }

            i=j;
        }

        if(best==0) cout<<0<<endl;
        else cout<<l<<" "<<r<<endl;
    }

    return 0;
}