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

#define ll long long
#define ld long double

#define out() cout<<"========================"<<endl
#define out1(a) cout<<#a<<" "<<a<<endl
#define out2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define out3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl
#define out4(a,b,c,d) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<" "<<#d<<" "<<d<<endl

#define mp make_pair
#define pb push_back
#define all(A)  A.begin(),A.end()
#define allr(A)	A.rbegin(),A.rend()
#define ft first
#define sd second

#define pll pair<ll,ll>
#define V vector<ll>
#define S set<ll>
#define VV vector<V>
#define Vpll vector<pll>

const ll logN = 20;
const ll M = 1000000007;
const ll INF = 1e12;
#define PI 3.14159265

const ll N = 100005;
const long int maxi=1000000;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t;
    cin>>t;
    while(t--)
    {
        ll n;cin>>n;
        Vpll v;ll a[n];
        ll i,j;for(i=0;i<n;i++)
        {
            cin>>a[i];
            v.pb(mp(a[i],i));
        }
        sort(v.begin(),v.end());
        ll k=abs(v.back().sd-v[0].sd)+1;
        ll z=0,a1,a2;
        for(i=v.size()-1;i>=1;i--)
        {
            for(j=max(0ll,i-k);j<i;j++)
            {
              if(v[i].ft-v[j].ft>=abs(v[i].sd-v[j].sd)+1)
              {
                  z++;a1=min(v[i].sd,v[j].sd);a2=max(v[i].sd,v[j].sd);
                  break;
              }
            }
            if(z>0){break;}
        }
        if(z==0){cout<<"NO"<<endl;}
        else
        {
            cout<<"YES"<<endl;
            cout<<a1+1<<" "<<a2+1<<endl;
        }

    }

}


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

#define ll long long
#define ld long double

#define out() cout<<"========================"<<endl
#define out1(a) cout<<#a<<" "<<a<<endl
#define out2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define out3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl
#define out4(a,b,c,d) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<" "<<#d<<" "<<d<<endl

#define mp make_pair
#define pb push_back
#define all(A)  A.begin(),A.end()
#define allr(A)	A.rbegin(),A.rend()
#define ft first
#define sd second

#define pll pair<ll,ll>
#define V vector<ll>
#define S set<ll>
#define VV vector<V>
#define Vpll vector<pll>

const ll logN = 20;
const ll M = 1000000007;
const ll INF = 1e12;
#define PI 3.14159265

const ll N = 100005;
const long int maxi=1000000;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t;
    cin>>t;
    while(t--)
    {
        ll n,i,z=0,a1,a2;
        cin>>n;
        ll a[n];
        for(i=0;i<n;i++)
        {
            cin>>a[i];
            if(i>0&&z==0)
            {
                if(abs(a[i]-a[i-1])>2)
                {a1=i;a2=i+1;z++;}
            }
        }
        if(z>0){cout<<"YES"<<endl;cout<<a1<<" "<<a2<<endl;}
         else{cout<<"NO"<<endl;}
    }
}


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

#define ll long long
#define ld long double

#define out() cout<<"========================"<<endl
#define out1(a) cout<<#a<<" "<<a<<endl
#define out2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define out3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl
#define out4(a,b,c,d) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<" "<<#d<<" "<<d<<endl

#define mp make_pair
#define pb push_back
#define all(A)  A.begin(),A.end()
#define allr(A)	A.rbegin(),A.rend()
#define ft first
#define sd second

#define pll pair<ll,ll>
#define V vector<ll>
#define S set<ll>
#define VV vector<V>
#define Vpll vector<pll>

const ll logN = 20;
const ll M = 1000000007;
const ll INF = 1e12;
#define PI 3.14159265

const ll N = 100005;
const long int maxi=1000000;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t;
    cin>>t;
    while(t--)
    {
        ll n,i,z=0,a1,a2;
        cin>>n;
        ll a[n];
        for(i=0;i<n;i++)
        {
            cin>>a[i];
            if(i>0&&z==0)
            {
                if(abs(a[i]-a[i-1])>=2)
                {a1=i;a2=i+1;z++;}
            }
        }
        if(z>0){cout<<"YES"<<endl;cout<<a1<<" "<<a2<<endl;}
         else{cout<<"NO"<<endl;}
    }
}


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

#define ll long long
#define ld long double

#define out() cout<<"========================"<<endl
#define out1(a) cout<<#a<<" "<<a<<endl
#define out2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define out3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl
#define out4(a,b,c,d) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<" "<<#d<<" "<<d<<endl

#define mp make_pair
#define pb push_back
#define all(A)  A.begin(),A.end()
#define allr(A)	A.rbegin(),A.rend()
#define ft first
#define sd second

#define pll pair<ll,ll>
#define V vector<ll>
#define S set<ll>
#define VV vector<V>
#define Vpll vector<pll>

const ll logN = 20;
const ll M = 1000000007;
const ll INF = 1e12;
#define PI 3.14159265

const ll N = 100005;
const long int maxi=1000000;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t;
    cin>>t;
    while(t--)
    {
        ll n;cin>>n;
        Vpll v;ll a[n];
        ll i,j;for(i=0;i<n;i++)
        {
            cin>>a[i];
            v.pb(mp(a[i],i));
        }
        sort(v.begin(),v.end());
        ll k=abs(v.back().sd-v[0].sd);
        ll z=0,a1,a2;
        for(i=n-1;i>=1;i--)
        {
            for(j=max(0ll,i-k);j<i;j++)
            {
              if(abs(a[i]-a[j])>=i-j+1)
              {
                  z++;a1=j;a2=i;
                  break;
              }
            }
            if(z>0){break;}
        }
        if(z==0){cout<<"NO"<<endl;}
        else
        {
            cout<<"YES"<<endl;
            cout<<a1+1<<" "<<a2+1<<endl;
        }

    }

}


#include <iostream>
#include <cstring>
#include <algorithm>
#include <cstdio>
#include <map>
#include <queue>
#include <vector>
#define inf 0x3f3f3f3f
#define ll long long
using namespace std;
typedef pair<int,int>  PII;

const int N = 2e5+10;

int t;
int n;
int a[N];

int main()
{
    scanf("%d",&t);
    while( t -- )
    {
        scanf("%d",&n);
        queue<PII> q;
        int idx = 0, ma = 0;
        for(int i = 1; i <= n ; i ++)
        {
            scanf("%d",&a[i]);
            ma = max(ma, a[i]);
        }

        for(int i = 1 ; i <= n ; i ++ )
            if(a[i] == ma )
            {
                idx = i ;
                break;
            }

        int mi = inf;
        int op = 1 ;
        int cnt = 0;
        for(int i = idx,k = idx ; i > 0 && k <= n ;)
        {
            mi = min(mi, a[i] );
            mi = min(mi, a[k] );
            if(ma - mi >= op)
            {
                cnt ++;
                q.push({i, k });
                break;
            }
            else if(i - 1 >0 && k + 1 <= n )
            {
                op += 2;
                continue;
            }
            else if(i - 1 <= 0 && k + 1 > n )
            {
                op += 0;
                break;
            }
            else if(i -1 >= 0 && k + 1 > n )
            {
                i -- ;
                op += 1;
                continue;
            }
            else
            {
                k ++ ;
                op += 1;
                continue;
            }
        }

        if( cnt == 0 )
            printf("NO\n");
        else
        {
            printf("YES\n");
            PII au;
            au = q.front(),q.pop();
            printf("%d %d\n",au.first,au.second);
        }
    }
    return 0;
}


#include <iostream>
#include <cstring>
#include <algorithm>
#include <cstdio>
#include <map>
#include <queue>
#include <vector>
#define inf 0x3f3f3f3f
#define ll long long
using namespace std;
typedef pair<int,int>  PII;

const int N = 2e5+10;

int t;
int n;
int a[N];

int main()
{
    scanf("%d",&t);
    while( t -- )
    {
        scanf("%d",&n);
        queue<PII> q;
        int idx = 0, ma = 0;
        for(int i = 1; i <= n ; i ++)
        {
            scanf("%d",&a[i]);
            ma = max(ma, a[i]);
        }

        for(int i = 1 ; i <= n ; i ++ )
            if(a[i] == ma )
            {
                idx = i ;
                break;
            }

        int mi = inf;
        int op = 1 ;
        int cnt = 0;
        for(int i = idx,k = idx ; i > 0 && k <= n ;)
        {
            mi = min(mi, a[i] );
            mi = min(mi, a[k] );
            if(ma - mi >= op)
            {
                cnt ++;
                q.push({i, k });
                break;
            }
            if(i - 1 >0 && k + 1 <= n )
                op += 2;
            else if(i - 1 <= 0 && k + 1 > n )
            {
                op += 0;
                break;
            }
            else if(i -1 >= 0 && k + 1 > n )
            {
                i -- ;
                op += 1;
            }
            else
            {
                k ++ ;
                op += 1;
            }
        }

        if( cnt == 0 )
            printf("NO\n");
        else
        {
            printf("YES\n");
            PII au;
            au = q.front(),q.pop();
            printf("%d %d\n",au.first,au.second);
        }
    }
    return 0;
}


#include <iostream>
#include <cstring>
#include <algorithm>
#include <cstdio>
#include <map>
#include <queue>
#include <vector>
#define inf 0x3f3f3f3f
#define ll long long
using namespace std;
typedef pair<int,int>  PII;

const int N = 2e5+10;

int t;
int n;
int a[N];
queue<PII> q;

int main()
{
    scanf("%d",&t);
    while( t -- )
    {
        scanf("%d",&n);
        int idx = 0, ma = 0;
        for(int i = 1; i <= n ; i ++)
        {
            scanf("%d",&a[i]);
            ma = max(ma, a[i]);
        }

        for(int i = 1 ; i <= n ; i ++ )
            if(a[i] == ma )
            {
                idx = i ;
                break;
            }

        int mi = inf;
        int op = 1 ;
        int cnt = 0;
        for(int i = idx,k = idx ; i > 0 && k <= n ;)
        {
            mi = min(mi, a[i] );
            mi = min(mi, a[k] );
            if(ma - mi >= op)
            {
                cnt ++;
                q.push({i, k });
            }
            if(i - 1 >0 && k + 1 <= n )
                op += 2;
            else if(i - 1 <= 0 && k + 1 > n )
            {
                op += 0;
                break;
            }
            else if(i -1 >= 0 && k + 1 > n )
            {
                i -- ;
                op += 1;
            }
            else
            {
                k ++ ;
                op += 1;
            }
        }

        if( cnt == 0 )
            printf("NO\n");
        else
        {
            printf("YES\n");
            PII au;
            au = q.front(),q.pop();
            printf("%d %d\n",au.first,au.second);
        }
    }
    return 0;
}


#include <iostream>
#include <cstring>
#include <algorithm>
#include <cstdio>
#include <map>
#include <queue>
#include <vector>
#define inf 0x3f3f3f3f
#define ll long long
using namespace std;
typedef pair<int,int>  PII;

const int N = 2e5+10;

int t;
int n;
int a[N];

int main()
{
    scanf("%d",&t);
    while( t -- )
    {
        scanf("%d",&n);
        queue<PII> q;
        int idx = 0, ma = 0;
        for(int i = 1; i <= n ; i ++)
        {
            scanf("%d",&a[i]);
            ma = max(ma, a[i]);
        }

        for(int i = 1 ; i <= n ; i ++ )
            if(a[i] == ma )
            {
                idx = i ;
                break;
            }

        int mi = inf;
        int op = 1 ;
        int cnt = 0;
        for(int i = idx,k = idx ; i > 0 && k <= n ;)
        {
            mi = min(mi, a[i] );
            mi = min(mi, a[k] );
            if(ma - mi >= op)
            {
                cnt ++;
                q.push({i, k });
            }
            if(i - 1 >0 && k + 1 <= n )
                op += 2;
            else if(i - 1 <= 0 && k + 1 > n )
            {
                op += 0;
                break;
            }
            else if(i -1 >= 0 && k + 1 > n )
            {
                i -- ;
                op += 1;
            }
            else
            {
                k ++ ;
                op += 1;
            }
        }

        if( cnt == 0 )
            printf("NO\n");
        else
        {
            printf("YES\n");
            PII au;
            au = q.front(),q.pop();
            printf("%d %d\n",au.first,au.second);
        }
    }
    return 0;
}


#include <iostream>
#include <cstring>
#include <algorithm>
#include <cstdio>
#include <map>
#include <queue>
#include <vector>
#define inf 0x3f3f3f3f
#define ll long long
using namespace std;
typedef pair<int,int>  PII;

const int N = 2e5+10;

int t;
int n;
int a[N];

int main()
{
    scanf("%d",&t);
    while( t -- )
    {
        scanf("%d",&n);
        queue<PII> q;
        int idx = 0, ma = 0;
        bool flag = false;

        for(int i = 1; i <= n ; i ++)
        {
            scanf("%d",&a[i]);
        }

        for(int i = 1; i < n ; i ++)
        {
            if(flag == false)
            {
                if(abs(a[i+1] - a[i] ) >= 2)
                {
                    printf("YES\n");
                    printf("%d %d",i,i+1);
                    puts("");
                        flag = true;
                }
            }
        }
        if(flag == false)
            printf("NO\n");
    }
    return 0;
}


#include <iostream>
#include <cstring>
#include <algorithm>
#include <cstdio>
#include <map>
#include <queue>
#include <vector>
#define inf 0x3f3f3f3f
#define ll long long
using namespace std;
typedef pair<int,int>  PII;

const int N = 2e5+10;

int t;
int n;
int a[N];

int main()
{
    scanf("%d",&t);
    while( t -- )
    {
        scanf("%d",&n);
        queue<PII> q;
        int idx = 0, ma = 0;
        bool flag = false;
        for(int i = 1; i <= n ; i ++)
        {
            scanf("%d",&a[i]);
            if(i != 1 )
            {
                if(abs(a[i] - a[i-1]) >= 2)
                    flag = true;
                q.push({i-1,i});
            }
        }
        if(flag)
        {
            printf("YES\n");
            PII au = q.front();
            printf("%d %d\n",au.first,au.second);
        }
        else
        {
            printf("NO\n");
        }
    }
    return 0;
}


#include <iostream>
#include <cstring>
#include <algorithm>
#include <cstdio>
#include <map>
#include <queue>
#include <vector>
#define inf 0x3f3f3f3f
#define ll long long
using namespace std;
typedef pair<int,int>  PII;

const int N = 2e5+10;

int t;
int n;
int a[N];

int main()
{
    scanf("%d",&t);
    while( t -- )
    {
        scanf("%d",&n);
        queue<PII> q;
        int idx = 0, ma = 0;
        bool flag = false;
        for(int i = 1; i <= n ; i ++)
        {
            scanf("%d",&a[i]);
            if(i != 1 )
            {
                if(a[i] - a[i-1] >= 2)
                    flag = true;
                q.push({i-1,i});
            }
        }
        if(flag)
        {
            printf("YES\n");
            PII au = q.front();
            printf("%d %d\n",au.first,au.second);
        }
        else
        {
            printf("NO\n");
        }
    }
    return 0;
}


#include <iostream>
#include <cstring>
#include <algorithm>
#include <cstdio>
#include <map>
#include <queue>
#include <vector>
#define inf 0x3f3f3f3f
#define ll long long
using namespace std;
typedef pair<int,int>  PII;

const int N = 2e5+10;

int t;
int n;
int a[N];

int main()
{
    scanf("%d",&t);
    while( t -- )
    {
        scanf("%d",&n);
        queue<PII> q;
        int idx = 0, ma = 0;
        bool flag = false;
        for(int i = 1; i <= n ; i ++)
        {
            scanf("%d",&a[i]);
            if(i != 1 )
            {
                if(a[i] - a[i-1] >= 2)
                    flag = true;
                q.push({i-1,i});
            }
        }
        if(flag)
        {
            printf("YES\n");
            PII au = q.front();
            printf("%d %d\n",au.first,au.second);
        }
    }
    return 0;
}


#include <iostream>
#include <cstring>
#include <algorithm>
#include <cstdio>
#include <map>
#include <queue>
#include <vector>
#define inf 0x3f3f3f3f
#define ll long long
using namespace std;
typedef pair<int,int>  PII;

const int N = 1e5+10;

int t;
int n;
int a[N];
queue<PII> q;

int main()
{
    scanf("%d",&t);
    while( t -- )
    {
        scanf("%d",&n);
        int idx = 0, ma = 0;
        for(int i = 1; i <= n ; i ++)
        {
            scanf("%d",&a[i]);
            ma = max(ma, a[i]);
        }

        for(int i = 1 ; i <= n ; i ++ )
            if(a[i] == ma )
            {
                idx = i ;
                break;
            }

        int mi = inf;
        int op = 1 ;
        int cnt = 0;
        for(int i = idx,k = idx ; i > 0 && k <= n ;)
        {
            mi = min(mi, a[i] );
            mi = min(mi, a[k] );
            if(ma - mi >= op)
            {
                cnt ++;
                q.push({i, k });
            }
            if(i - 1 >0 && k + 1 <= n )
                op += 2;
            else if(i - 1 <= 0 && k + 1 > n )
            {
                op += 0;
                break;
            }
            else if(i -1 >= 0 && k + 1 > n )
            {
                i -- ;
                op += 1;
            }
            else
            {
                k ++ ;
                op += 1;
            }
        }

        if( cnt == 0 )
            printf("NO\n");
        else
        {
            printf("YES\n");
            PII au;
            au = q.front(),q.pop();
            printf("%d %d\n",au.first,au.second);
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int t;
    cin>>t;
    while(t--){
        int n;
        cin>>n;
        vector<int> niz(n);
        for(int i=0;i<n;i++) cin>>niz[i];
        bool moze=false;
        for(int i=1;i<n;i++){
            if(abs(niz[i]-niz[i-1])>=2){
                moze=true;
                cout<<"YES\n";
                cout<<i<<" "<<i+1<<"\n";
                break;
            }
        }
        if(!moze){
            cout<<"NO\n";
        }
    }
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int t;
    cin>>t;
    while(t--){
        int n;
        cin>>n;
        vector<int> niz(n);
        for(int i=0;i<n;i++) cin>>niz[i];
        bool moze=false;
        for(int i=1;i<n;i++){
            if(abs(niz[i]-niz[i-1])){
                moze=true;
                cout<<"YES\n";
                cout<<i<<" "<<i+1<<"\n";
            }
        }
        if(!moze){
            cout<<"NO\n";
        }
    }
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int t;
    cin>>t;
    while(t--){
        int n;
        cin>>n;
        int prosli=0;
        cin>>prosli;
        bool moze=false;
        for(int i=1;i<n;i++){
            int a;
            cin>>a;
            if(a-prosli>=2){
                moze=true;
                cout<<"YES\n";
                cout<<i-1<<" "<<i<<"\n";
                break;
            }
            prosli=a;
        }
        if(!moze){
            cout<<"NO\n";
        }
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int t;
    cin>>t;
    while(t--){
        int n;
        cin>>n;
        vector<int> niz(n);
        int mini=1000000001;
        int brm=0;
        int maxi=0;
        int brma=0;
        for(int i=0;i<n;i++){
            cin>>niz[i];
        }
        int l=0;
        int r=n-1;
        bool ima=false;
        while(l<=r){
            while(l<r && niz[l]==niz[l+1]) l++;
            while(r>l && niz[r]==niz[r-1]) r--;
            if(r-l+1<=max(niz[l],niz[r])-min(niz[l],niz[r])){
                ima=true;
                break;
            }
            if(max(niz[l+1],niz[r])-min(niz[l+1],niz[r])>max(niz[l],niz[r-1])-min(niz[l],niz[r-1])){
                l++;
            }else{
                r--;
            }
        }
        if(ima){
            cout<<"YES\n";
            cout<<l+1<<" "<<r+1<<"\n";
        }else{
            cout<<"NO\n";
        }
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int t;
    cin>>t;
    while(t--){
        int n;
        cin>>n;
        int prosli=0;
        cin>>prosli;
        bool moze=false;
        for(int i=1;i<n;i++){
            int a;
            cin>>a;
            if(abs(a-prosli)>=2){
                moze=true;
                cout<<"YES\n";
                cout<<i-1<<" "<<i<<"\n";
                break;
            }
            prosli=a;
        }
        if(!moze){
            cout<<"NO\n";
        }
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int t;
    cin>>t;
    while(t--){
        int n;
        cin>>n;
        int prosli=0;
        cin>>prosli;
        bool moze=false;
        for(int i=1;i<n;i++){
            int a;
            cin>>a;
            if(a-prosli>=2){
                moze=true;
                cout<<"YES\n";
                cout<<i<<" "<<i+1<<"\n";
                break;
            }
            prosli=a;
        }
        if(!moze){
            cout<<"NO\n";
        }
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int t;
    cin>>t;
    while(t--){
        int n;
        cin>>n;
        int prosli=0;
        cin>>prosli;
        bool moze=false;
        for(int i=1;i<n;i++){
            int a;
            cin>>a;
            if(abs(a-prosli)>=2){
                moze=true;
                cout<<"YES\n";
                cout<<i<<" "<<i+1<<"\n";
                break;
            }
            prosli=a;
        }
        if(!moze){
            cout<<"NO\n";
        }
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int t;
    cin>>t;
    while(t--){
        int n;
        cin>>n;
        int prosli=0;
        bool moze=false;
        for(int i=0;i<n;i++){
            int a;
            cin>>a;
            if(abs(a-prosli)>=2 && i>0){
                moze=true;
                cout<<"YES\n";
                cout<<i<<" "<<i+1<<"\n";
                break;
            }
            prosli=a;
        }
        if(!moze){
            cout<<"NO\n";
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int t;
    cin>>t;
    while(t--){
        int n;
        cin>>n;
        vector<int> niz(n);
        for(int i=0;i<n;i++) cin>>niz[i];
        bool moze=false;
        for(int i=1;i<n;i++){
            if(abs(niz[i]-niz[i-1])){
                moze=true;
                cout<<"YES\n";
                cout<<i<<" "<<i+1<<"\n";
                break;
            }
        }
        if(!moze){
            cout<<"NO\n";
        }
    }
}


// By AmmarDab3an - Aleppo University.

#include <bits/stdc++.h>

using namespace std;

#define FOR(i, f, t, s)     for(int i = f; i <  t; i += s)
#define RFOR(i, f, t, s)    for(int i = f; j >= t; i -= s)
#define REP(i, n)           FOR(i, 0, n, 1)
#define RREP(i, n)          RFOR(i, n, 0, 1))

#define MEM(a, b)       memset(a, b, sizeof a)

#define inputInt(i)     scanf("%d", &i)
#define inputII(i, j)   scanf("d", &i, &j)
#define inputLli(i)     scanf("%lld", &i)
#define inputF(f)       scanf("%f", &f)
#define inputC(c)       scanf("%c", &c)
#define printInt(i)     printf("%d", i)
#define printII(i, j)   printf("%d %d", i, j)
#define printLli(i)     printf("%lld", i)
#define printStr(s)     printf("%s", s.c_str())
#define printC(c)       printf("%c", c)
#define printEndl()     printf("\n")

#define INF     (int)1e9
#define EPS      1e-9
#define PI       3.1415926535897932384626433832795
#define MOD      1000000007

typedef long long           lli;
typedef pair<int, int>      pii;
typedef pair<pii, int>      iii;
typedef pair<lli, lli>      pll;
typedef pair<lli, pll>      lll;
typedef vector<int>         vi;
typedef vector<lli>         vll;
typedef vector<pii>         vpii;

//Declarations
const int UVA = true;
const int MAX = 200020;

int n;
int arr[MAX];

void go()
{
    inputInt(n);
    REP(i, n)
        inputInt(arr[i]);

    bool found = false;
    FOR(i, 1, n, 1)
    {
        if(abs(arr[i] - arr[i-1]) >= 2)
        {
            printf("YES\n");
            printII(i, i+1);
            printEndl();
            found = true;
            break;
        }
    }
    if(!found)
        printf("NO\n");
}
int main()
{
    int t = 1;
    if(UVA) inputInt(t); while(t--)
        go();
}


/*
author : rahil_1407
motto : Time Management,Consistency,Patience!!
*/

#include <bits/stdc++.h>
#define SPEED ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define endl '\n'
#define f first
#define s second
#define pii pair<int,int>
#define vi vector<int>
#define mp make_pair
#define pb push_back
#define For(i,a,b) for(int i=a;i<b;i++)
#define ford(i,a,b) for(int i=a;i>=b;i--)
#define pi 3.1415926536
#define MAX 1000005
#define ll int long long

const ll N=10e8+7;
using namespace std;

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

        int arr[n],mx=INT_MIN,l,r;
        For(i,0,n)
        {
            cin>>arr[i];
            if(mx<arr[i])
            {
                mx=arr[i];
                r=i;
            }
        }

        bool flag=0;
        int i=r;
        i+=1;
        while(i<n && !flag)
        {
            if(mx-arr[i]>=(i-r+1))
            {
                flag=1;
                l=i;
                break;
            }
            i++;
        }

        i=r;
        i-=1;
        while(i>=0 && !flag)
        {
            if(mx-arr[i]>=(r-i+1))
            {
                flag=1;
                l=i;
                break;
            }
            i--;
        }

        if(flag)
        {
            cout<<"YES"<<endl;
            cout<<min(l,r)+1<<" "<<max(l,r)+1<<endl;
        }
        else
         cout<<"NO"<<endl;
    }
}


/*
author : rahil_1407
motto : Time Management,Consistency,Patience!!
*/

#include <bits/stdc++.h>
#define SPEED ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define endl '\n'
#define f first
#define s second
#define pii pair<int,int>
#define vi vector<int>
#define mp make_pair
#define pb push_back
#define For(i,a,b) for(int i=a;i<b;i++)
#define ford(i,a,b) for(int i=a;i>=b;i--)
#define pi 3.1415926536
#define MAX 1000005
#define ll int long long

const ll N=10e8+7;
using namespace std;

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

        int arr[n],mx=INT_MIN,idx=-1,idx_=-1,r;
        For(i,0,n)
        {
            cin>>arr[i];
            if(mx<arr[i])
            {
                mx=arr[i];
                idx=i;
            }
        }

        r=idx;
        bool flag=0;
        int i;
        while(i<n)
        {
            if(mx-arr[i]>=(i-r+1))
            {
                flag=1;
                idx_=i;
                break;
            }
            i++;
        }

        i=r;
        while(i>=0)
        {
            if(mx-arr[i]>=(r-i+1))
            {
                flag=1;
                idx_=i;
                break;
            }
            i--;
        }

        if(flag)
        {
            cout<<"YES"<<endl;
            cout<<idx_+1<<" "<<r+1<<endl;
        }
        else
         cout<<"NO"<<endl;
    }
}


/*
author : rahil_1407
motto : Time Management,Consistency,Patience!!
*/

#include <bits/stdc++.h>
#define SPEED ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define endl '\n'
#define f first
#define s second
#define pii pair<int,int>
#define vi vector<int>
#define mp make_pair
#define pb push_back
#define For(i,a,b) for(int i=a;i<b;i++)
#define ford(i,a,b) for(int i=a;i>=b;i--)
#define pi 3.1415926536
#define MAX 1000005
#define ll int long long

const ll N=10e8+7;
using namespace std;

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

        int arr[n],mx=INT_MIN,l,r;
        For(i,0,n)
        {
            cin>>arr[i];
            if(mx<arr[i])
            {
                mx=arr[i];
                r=i;
            }
        }

        bool flag=0;
        int i=r,mn=arr[r];

        while(i<n && !flag)
        {
            mn=min(mn,arr[i]);
            if((mx-mn)>=(i-r+1))
            {
                flag=1;
                l=i;
                break;
            }
            i++;
        }

        i=r,mn=arr[r];
        while(i>=0 && !flag)
        {
            mn=min(mn,arr[i]);
            if((mx-mn)>=(r-i+1))
            {
                flag=1;
                l=i;
                break;
            }
            i--;
        }

        if(flag)
        {
            cout<<"YES"<<endl;
            cout<<min(l,r)+1<<" "<<max(l,r)+1<<endl;
        }
        else
         cout<<"NO"<<endl;
    }
}


/*
author : rahil_1407
motto : Time Management,Consistency,Patience!!
*/

#include <bits/stdc++.h>
#define SPEED ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define endl '\n'
#define f first
#define s second
#define pii pair<int,int>
#define vi vector<int>
#define mp make_pair
#define pb push_back
#define For(i,a,b) for(int i=a;i<b;i++)
#define ford(i,a,b) for(int i=a;i>=b;i--)
#define pi 3.1415926536
#define MAX 1000005
#define ll int long long

const ll N=10e8+7;
using namespace std;

//Thanks to monster for giving everyday help
//Think of final state of array
//You will prove that at least once you have to take a jump of 2

int main()
{
    SPEED;
    int t;
    cin>>t;

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

        int arr[n];
        For(i,0,n)
         cin>>arr[i];

        bool flag=0;
        int l,r;

        For(i,1,n)
        {
            if(arr[i]-arr[i-1]>=2)
             l=i-1,r=i,flag=1;
        }

        if(flag)
        {
            cout<<"YES"<<endl;
            cout<<l<<" "<<r<<endl;
        }
        else
         cout<<"NO"<<endl;
    }
}


/*
author : rahil_1407
motto : Time Management,Consistency,Patience!!
*/

#include <bits/stdc++.h>
#define SPEED ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define endl '\n'
#define f first
#define s second
#define pii pair<int,int>
#define vi vector<int>
#define mp make_pair
#define pb push_back
#define For(i,a,b) for(int i=a;i<b;i++)
#define ford(i,a,b) for(int i=a;i>=b;i--)
#define pi 3.1415926536
#define MAX 1000005
#define ll int long long

const ll N=10e8+7;
using namespace std;

//Thanks to monster for giving everyday help
//Think of final state of array
//You will prove that at least once you have to take a jump of 2

int main()
{
    SPEED;
    int t;
    cin>>t;

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

        int arr[n];
        For(i,0,n)
         cin>>arr[i];

        bool flag=0;
        int l,r;

        For(i,1,n)
        {
            if(fabs(arr[i]-arr[i-1])>=2)
             l=i-1,r=i,flag=1;
        }

        if(flag)
        {
            cout<<"YES"<<endl;
            cout<<l+1<<" "<<r+1<<endl;
        }
        else
         cout<<"NO"<<endl;
    }
}


/*
author : rahil_1407
motto : Time Management,Consistency,Patience!!
*/

#include <bits/stdc++.h>
#define SPEED ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define endl '\n'
#define f first
#define s second
#define pii pair<int,int>
#define vi vector<int>
#define mp make_pair
#define pb push_back
#define For(i,a,b) for(int i=a;i<b;i++)
#define ford(i,a,b) for(int i=a;i>=b;i--)
#define pi 3.1415926536
#define MAX 1000005
#define ll int long long

const ll N=10e8+7;
using namespace std;

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

        int arr[n],mx=INT_MIN,l,r;
        For(i,0,n)
        {
            cin>>arr[i];
            if(mx<arr[i])
            {
                mx=arr[i];
                r=i;
            }
        }

        bool flag=0;
        int i=r;
        i+=1;
        while(i<n && !flag)
        {
            if(mx-arr[i]>=(i-r+1))
            {
                flag=1;
                l=i;
                break;
            }
            i++;
        }

        i=r;
        i-=1;
        while(i>=0 && !flag)
        {
            if(mx-arr[i]>=(r-i+1))
            {
                flag=1;
                l=i;
                break;
            }
            i--;
        }

        if(flag)
        {
            cout<<"YES"<<endl;
            cout<<l+1<<" "<<r+1<<endl;
        }
        else
         cout<<"NO"<<endl;
    }
}


/*
author : rahil_1407
motto : Time Management,Consistency,Patience!!
*/

#include <bits/stdc++.h>
#define SPEED ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define endl '\n'
#define f first
#define s second
#define pii pair<int,int>
#define vi vector<int>
#define mp make_pair
#define pb push_back
#define For(i,a,b) for(int i=a;i<b;i++)
#define ford(i,a,b) for(int i=a;i>=b;i--)
#define pi 3.1415926536
#define MAX 1000005
#define ll int long long

const ll N=10e8+7;
using namespace std;

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

        int arr[n],mx=INT_MIN,l,r;
        For(i,0,n)
        {
            cin>>arr[i];
            if(mx<arr[i])
            {
                mx=arr[i];
                r=i;
            }
        }

        bool flag=0;
        int i=r,mn=arr[r];

        while(i<n && !flag)
        {
            mn=min(mn,arr[i]);
            if(mx-mn>=(i-r+1))
            {
                flag=1;
                l=i;
                break;
            }
            i++;
        }

        i=r,mn=arr[r];
        while(i>=0 && !flag)
        {
            mn=min(mn,arr[i]);
            if(mx-mn>=(r-i+1))
            {
                flag=1;
                l=i;
                break;
            }
            i--;
        }

        if(flag)
        {
            cout<<"YES"<<endl;
            cout<<min(l,r)+1<<" "<<max(l,r)+1<<endl;
        }
        else
         cout<<"NO"<<endl;
    }
}


/*
author : rahil_1407
motto : Time Management,Consistency,Patience!!
*/

#include <bits/stdc++.h>
#define SPEED ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define endl '\n'
#define f first
#define s second
#define pii pair<int,int>
#define vi vector<int>
#define mp make_pair
#define pb push_back
#define For(i,a,b) for(int i=a;i<b;i++)
#define ford(i,a,b) for(int i=a;i>=b;i--)
#define pi 3.1415926536
#define MAX 1000005
#define ll int long long

const ll N=10e8+7;
using namespace std;

//Thanks to monster for giving everyday help
//Think of final state of array
//You will prove that at least once you have to take a jump of 2

int main()
{
    SPEED;
    int t;
    cin>>t;

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

        int arr[n];
        For(i,0,n)
         cin>>arr[i];

        bool flag=0;
        int l,r;

        For(i,1,n)
        {
            if(arr[i]-arr[i-1]>=2)
             l=i-1,r=i,flag=1;
        }

        if(flag)
        {
            cout<<"YES"<<endl;
            cout<<l+1<<" "<<r+1<<endl;
        }
        else
         cout<<"NO"<<endl;
    }
}


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int max_a, min_a;
int l, r;

bool interesting_subarray( vector<int> &a, int start_A, int end_A){/// 0 ----- (n-1)

	//cout<<"start : "<<start<<"  end:"<<end<<endl;
	int length = end_A -(start_A-1);
	if( length <=1){
		//cout<<"length : "<<length<<endl;
		return false;

	}

	max_a = a[end_A];
	min_a = a[start_A];
	//cout<<"max_a"<<max_a<<endl;
	//cout<<"min_a"<<min_a<<endl;

	if( max_a-min_a >= length ){
	    l = start_A;
	    r = end_A;
		return true;

	}

	return interesting_subarray(a, start_A+1, end_A) || interesting_subarray(a,start_A, end_A-1);

}

int main(){

	int tests_cases;
	cin>>tests_cases;
	///cout<<"test_cases : "<<tests_cases<<endl;
	int t=0;
	while(t< tests_cases){

		int n;
		cin>>n;
		vector<int> a;

		int j=0;

		while(j<n){
			int tmp;
			cin>>tmp;
			a.push_back(tmp);
			j++;
		}
		//cout<<"tamaño :"<<a.size()<<endl;
		sort(a.begin(), a.end());

		bool rpta;
		rpta= "yes";
		rpta = interesting_subarray(a, 0, n-1);
		if(rpta){
			cout<<"YES"<<endl;
			cout<<l+1<<" "<<r+1<<endl;

		}
		else{
			cout<<"NO"<<endl;
		}

		t++;
	}

	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int max_a, min_a;
int l, r;

bool interesting_subarray( vector<int> &a, int start, int end){/// 0 ----- (n-1)

	//cout<<"start : "<<start<<"  end:"<<end<<endl;
	int length = end -(start-1);
	if( length <=1){
		//cout<<"length : "<<length<<endl;
		return false;

	}

	max_a = a[end];
	min_a = a[start];
	//cout<<"max_a"<<max_a<<endl;
	//cout<<"min_a"<<min_a<<endl;

	if( max_a-min_a >= length ){
	    l = start;
	    r = end;
		return true;

	}

	return interesting_subarray(a, start+1, end) || interesting_subarray(a,start, end-1);

}

int main(){

	int tests;
	cin>>tests;
	int t=0;
	while(t< tests){

		int n;
		cin>>n;
		vector<int> a;

		int j=0;

		while(j<n){
			int tmp;
			cin>>tmp;
			a.push_back(tmp);
			j++;
		}
		//cout<<"tamaño :"<<a.size()<<endl;
		sort(a.begin(), a.end());
		bool rpta = interesting_subarray(a, 0, n-1);
		if(rpta){
			cout<<"YES\n";
			cout<<l+1<<" "<<r+1<<endl;

		}
		else{
			cout<<"NO\n";
		}

		t++;
	}

	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int max_a, min_a;
int l, r;

bool interesting_subarray( vector<int> &a, int start, int end){/// 0 ----- (n-1)

	//cout<<"start : "<<start<<"  end:"<<end<<endl;
	int length = end -(start-1);
	if( length <=1){
		//cout<<"length : "<<length<<endl;
		return false;

	}

	max_a = a[end];
	min_a = a[start];
	//cout<<"max_a"<<max_a<<endl;
	//cout<<"min_a"<<min_a<<endl;

	if( max_a-min_a >= length ){
	    l = start;
	    r = end;
		return true;

	}

	return interesting_subarray(a, start+1, end) || interesting_subarray(a,start, end-1);

}

int main(){

	int tests;
	cin>>tests;

	while(tests--){

		int n;
		cin>>n;
		vector<int> a;

		int j=0;

		while(j<n){
			int tmp;
			cin>>tmp;
			a.push_back(tmp);
			j++;
		}
		//cout<<"tamaño :"<<a.size()<<endl;
		sort(a.begin(), a.end());
		bool rpta = interesting_subarray(a, 0, n-1);
		if(rpta){
			cout<<"YES\n";
			cout<<l+1<<" "<<r+1<<endl;

		}
		else{
			cout<<"NO";
		}

	}

	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int max_a, min_a;
int l, r;

bool interesting_subarray( vector<int> &a, int start_A, int end_A){/// 0 ----- (n-1)

	int length_A = end_A -(start_A-1);
	if( length_A <=1){
		return false;

	}

	else{

		max_a = a[end_A];
		min_a = a[start_A];

		if( max_a-min_a >= length_A ){
			l = start_A;
			r = end_A;
			return true;

		}
		else{
			bool leftRpta = interesting_subarray(a, start_A+1, end_A);
			bool rightRpta = interesting_subarray(a,start_A, end_A-1);
			return leftRpta || rightRpta;
		}

	}

}

int main(){

	int tests_cases;
	int n;
	cin>>tests_cases;

	int t=0;

	while(t< tests_cases){

		vector<int> a;
		cin>>n;
		int j=0;
		while(j<n){
			int tmp;
			cin>>tmp;
			a.push_back(tmp);
			j++;
		}

		sort(a.begin(), a.end());

		bool my_rpta;
		my_rpta= "yes";
		my_rpta = interesting_subarray(a, 0, n-1);

		if(my_rpta){
			cout<<"YES"<<endl;
			cout<<l+1<<" "<<r+1<<endl;
		}
		else{
			cout<<"NO"<<endl;
		}

		t++;
	}

	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int max_a, min_a;
int l, r;

inline bool interesting_subarray( vector<int> &a, int start_A, int end_A){/// 0 ----- (n-1)

	//cout<<"start : "<<start<<"  end:"<<end<<endl;
	int length_A = end_A -(start_A-1);
	if( length_A <=1){
		//cout<<"length : "<<length<<endl;
		return false;

	}

	else{

		max_a = a[end_A];
		min_a = a[start_A];

		if( max_a-min_a >= length_A ){
			l = start_A;
			r = end_A;
			return true;

		}
		else{
			return interesting_subarray(a, start_A+1, end_A) || interesting_subarray(a,start_A, end_A-1);
		}

	}

}

int main(){

	int tests_cases;
	int n;
	cin>>tests_cases;
	///cout<<"test_cases : "<<tests_cases<<endl;

	int t=0;

	while(t< tests_cases){

		cout<<"tests_cases:"<<tests_cases<<endl;
		vector<int> a;
		cin>>n;
		int j=0;
		while(j<n){
			int tmp;
			cin>>tmp;
			a.push_back(tmp);
			j++;
		}

		//cout<<"tamaño :"<<a.size()<<endl;
		sort(a.begin(), a.end());

		bool my_rpta;
		my_rpta= "yes";
		my_rpta = interesting_subarray(a, 0, n-1);

		if(my_rpta){
			cout<<"YES"<<endl;
			cout<<l+1<<" "<<r+1<<endl;
		}
		else{
			cout<<"NO"<<endl;
		}

		t++;
	}

	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int max_a, min_a;
int l, r;

inline bool interesting_subarray( vector<int> &a, int start_A, int end_A){/// 0 ----- (n-1)

	//cout<<"start : "<<start<<"  end:"<<end<<endl;
	int length_A = end_A -(start_A-1);
	if( length_A <=1){
		//cout<<"length : "<<length<<endl;
		return false;

	}

	else{

		max_a = a[end_A];
		min_a = a[start_A];

		if( max_a-min_a >= length_A ){
			l = start_A;
			r = end_A;
			return true;

		}
		else{
			return interesting_subarray(a, start_A+1, end_A) || interesting_subarray(a,start_A, end_A-1);
		}

	}

}

int main(){

	int tests_cases;
	int n;
	cin>>tests_cases;
	///cout<<"test_cases : "<<tests_cases<<endl;

	int t=0;

	while(t< tests_cases){

		vector<int> a;
		cin>>n;
		int j=0;
		while(j<n){
			int tmp;
			cin>>tmp;
			a.push_back(tmp);
			j++;
		}

		//cout<<"tamaño :"<<a.size()<<endl;
		sort(a.begin(), a.end());

		bool my_rpta;
		my_rpta= "yes";
		my_rpta = interesting_subarray(a, 0, n-1);

		if(my_rpta){
			cout<<"YES"<<endl;
			cout<<l+1<<" "<<r+1<<endl;
		}
		else{
			cout<<"NO"<<endl;
		}

		t++;
	}

	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int max_a, min_a;
int l, r;

bool interesting_subarray( vector<int> &a, int start, int end){/// 0 ----- (n-1)

	//cout<<"start : "<<start<<"  end:"<<end<<endl;
	int length = end -(start-1);
	if( length <=1){
		//cout<<"length : "<<length<<endl;
		return false;

	}

	max_a = a[end];
	min_a = a[start];
	//cout<<"max_a"<<max_a<<endl;
	//cout<<"min_a"<<min_a<<endl;

	if( max_a-min_a >= length ){
	    l = start;
	    r = end;
		return true;

	}

	return interesting_subarray(a, start+1, end) || interesting_subarray(a,start, end-1);

}

int main(){

	int tests;
	cin>>tests;

	while(tests--){

		int n;
		cin>>n;
		vector<int> a;

		int j=0;

		while(j<n){
			int tmp;
			cin>>tmp;
			a.push_back(tmp);
			j++;
		}
		//cout<<"tamaño :"<<a.size()<<endl;
		sort(a.begin(), a.end());
		bool rpta = interesting_subarray(a, 0, n-1);
		if(rpta){
			cout<<"YES\n";
			cout<<l+1<<" "<<r+1<<endl;

		}
		else{
			cout<<"NO\n";
		}

	}

	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int max_a, min_a;
int l, r;

bool interesting_subarray( vector<int> &a, int start_A, int end_A){/// 0 ----- (n-1)

	//cout<<"start : "<<start<<"  end:"<<end<<endl;
	int length_A = end_A -(start_A-1);
	if( length_A <=1){
		//cout<<"length : "<<length<<endl;
		return false;

	}

	else{

		max_a = a[end_A];
		min_a = a[start_A];

		if( max_a-min_a >= length_A ){
			l = start_A;
			r = end_A;
			return true;

		}
		else{
			bool leftRpta = interesting_subarray(a, start_A+1, end_A);
			bool rightRpta = interesting_subarray(a,start_A, end_A-1);
			return leftRpta || rightRpta;
		}

	}

}

int main(){

	int tests_cases;
	int n;
	cin>>tests_cases;
	///cout<<"test_cases : "<<tests_cases<<endl;

	int t=0;

	while(t< tests_cases){

		///cout<<"tests_cases:"<<tests_cases<<endl;
		vector<int> a;
		cin>>n;
		int j=0;
		while(j<n){
			int tmp;
			cin>>tmp;
			a.push_back(tmp);
			j++;
		}

		//cout<<"tamaño :"<<a.size()<<endl;
		sort(a.begin(), a.end());

		bool my_rpta;
		my_rpta= "yes";
		my_rpta = interesting_subarray(a, 0, n-1);

		if(my_rpta){
			cout<<"YES"<<endl;
			cout<<l+1<<" "<<r+1<<endl;
		}
		else{
			cout<<"NO"<<endl;
		}

		t++;
	}

	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int max_a, min_a;
int l, r;

bool interesting_subarray( vector<int> &a, int start_A, int end_A){/// 0 ----- (n-1)

	//cout<<"start : "<<start<<"  end:"<<end<<endl;
	int length = end_A -(start_A-1);
	if( length <=1){
		//cout<<"length : "<<length<<endl;
		return false;

	}

	max_a = a[end_A];
	min_a = a[start_A];
	//cout<<"max_a"<<max_a<<endl;
	//cout<<"min_a"<<min_a<<endl;

	if( max_a-min_a >= length ){
	    l = start_A;
	    r = end_A;
		return true;

	}

	return interesting_subarray(a, start_A+1, end_A) || interesting_subarray(a,start_A, end_A-1);

}

int main(){

	int tests_cases;
	cin>>tests_cases;
	int t=0;
	while(t< tests_cases){

		int n;
		cin>>n;
		vector<int> a;

		int j=0;

		while(j<n){
			int tmp;
			cin>>tmp;
			a.push_back(tmp);
			j++;
		}
		//cout<<"tamaño :"<<a.size()<<endl;
		sort(a.begin(), a.end());
		bool rpta = interesting_subarray(a, 0, n-1);
		if(rpta){
			cout<<"YES\n";
			cout<<l+1<<" "<<r+1<<endl;

		}
		else{
			cout<<"NO\n";
		}

		t++;
	}

	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){

	int testcases, n;
	vector<int> a;

	cin>>testcases;

	while(testcases--){

		a.clear();
		cin>>n;

		for(int i=0; i<n;i++){
			int tmp;
			cin>>tmp;
			a.push_back(tmp);

		}

		bool rpta=false;
		for( int i=0; i<a.size()-1; i++){

			if(abs(a[i]-a[i+1])>=2) {
				rpta = true;
				cout<<"YES\n";
				cout<<(i+1)<<" "<<(i+1)+1<<endl;
				break;
			}
		}

		if(!rpta) cout<<"NO\n";

	}

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    cin.tie(0); cout.tie(0);
    ios_base::sync_with_stdio(false);

    int t; cin >> t;

    while (t--)
    {
        int n; cin >> n;
        vector<int> table(n);

        for (int i = 0; i < n; ++i)
            cin >> table[i];

        bool pass(false);

        for (int j = 1; j < n; ++j)
        {
            if (abs(table[j] - table[j - 1]) >= 2)
            {
                cout << "YES\n" << j << " " << j + 1 << "\n";
                pass = true;
                break;
            }
        }

        if (!pass)
            cout << "NO\n";
    }
}


#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){

	int testcases, n;
	vector<int> a;

	cin>>testcases;

	while(testcases--){

		a.clear();
		cin>>n;

		for(int i=0; i<n;i++){
			int tmp;
			cin>>tmp;
			a.push_back(tmp);

		}

		bool rpta=false;
		for( int i=0; i<a.size()-1; i++){

			if(abs(a[i]-a[i+1])>=2) {
				rpta = true;
				cout<<"YES\n";
				cout<<i<<" "<<i+1<<endl;
				break;
			}
		}

		if(!rpta) cout<<"NO\n";

	}

	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int max_a, min_a;
int l, r;

inline bool interesting_subarray( vector<int> &a, int start_A, int end_A){/// 0 ----- (n-1)

	//cout<<"start : "<<start<<"  end:"<<end<<endl;
	int length_A = end_A -(start_A-1);
	if( length_A <=1){
		//cout<<"length : "<<length<<endl;
		return false;

	}

	else{

		max_a = a[end_A];
		min_a = a[start_A];

		if( max_a-min_a >= length_A ){
			l = start_A;
			r = end_A;
			return true;

		}
		else{
			return interesting_subarray(a, start_A+1, end_A) || interesting_subarray(a,start_A, end_A-1);
		}

	}

}

int main(){

	int tests_cases;
	int n;
	cin>>tests_cases;
	///cout<<"test_cases : "<<tests_cases<<endl;

	int t=0;

	while(t< tests_cases){

		///cout<<"tests_cases:"<<tests_cases<<endl;
		vector<int> a;
		cin>>n;
		int j=0;
		while(j<n){
			int tmp;
			cin>>tmp;
			a.push_back(tmp);
			j++;
		}

		//cout<<"tamaño :"<<a.size()<<endl;
		sort(a.begin(), a.end());

		bool my_rpta;
		my_rpta= "yes";
		my_rpta = interesting_subarray(a, 0, n-1);

		if(my_rpta){
			cout<<"YES"<<endl;
			cout<<l+1<<" "<<r+1<<endl;
		}
		else{
			cout<<"NO"<<endl;
		}

		t++;
	}

	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int max_a, min_a;
int l, r;

inline bool interesting_subarray( vector<int> &a, int start_A, int end_A){/// 0 ----- (n-1)

	//cout<<"start : "<<start<<"  end:"<<end<<endl;
	int length = end_A -(start_A-1);
	if( length <=1){
		//cout<<"length : "<<length<<endl;
		return false;

	}

	max_a = a[end_A];
	min_a = a[start_A];
	//cout<<"max_a"<<max_a<<endl;
	//cout<<"min_a"<<min_a<<endl;

	if( max_a-min_a >= length ){
	    l = start_A;
	    r = end_A;
		return true;

	}

	return interesting_subarray(a, start_A+1, end_A) || interesting_subarray(a,start_A, end_A-1);

}

int main(){

	int tests_cases;
	cin>>tests_cases;
	///cout<<"test_cases : "<<tests_cases<<endl;
	int t=0;
	while(t< tests_cases){

		int n;
		cin>>n;
		vector<int> a;

		int j=0;

		while(j<n){
			int tmp;
			cin>>tmp;
			a.push_back(tmp);
			j++;
		}
		//cout<<"tamaño :"<<a.size()<<endl;
		sort(a.begin(), a.end());

		bool rpta;
		rpta= "yes";
		rpta = interesting_subarray(a, 0, n-1);
		if(rpta){
			cout<<"YES"<<endl;
			cout<<l+1<<" "<<r+1<<endl;

		}
		else{
			cout<<"NO"<<endl;
		}

		t++;
	}

	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int max_a, min_a;
int l, r;

inline bool interesting_subarray( vector<int> &a, int start_A, int end_A){/// 0 ----- (n-1)

	//cout<<"start : "<<start<<"  end:"<<end<<endl;
	int length = end_A -(start_A-1);
	if( length <=1){
		//cout<<"length : "<<length<<endl;
		return false;

	}

	else{

		max_a = a[end_A];
		min_a = a[start_A];

		if( max_a-min_a >= length ){
			l = start_A;
			r = end_A;
			return true;

		}
		else{
			return interesting_subarray(a, start_A+1, end_A) || interesting_subarray(a,start_A, end_A-1);
		}

	}

}

int main(){

	int tests_cases;
	cin>>tests_cases;
	///cout<<"test_cases : "<<tests_cases<<endl;
	int t=0;
	while(t< tests_cases){

		int n;
		cin>>n;
		vector<int> a;

		int j=0;

		while(j<n){
			int tmp;
			cin>>tmp;
			a.push_back(tmp);
			j++;
		}
		//cout<<"tamaño :"<<a.size()<<endl;
		sort(a.begin(), a.end());

		bool rpta;
		rpta= "yes";
		rpta = interesting_subarray(a, 0, n-1);
		if(rpta){
			cout<<"YES"<<endl;
			cout<<l+1<<" "<<r+1<<endl;

		}
		else{
			cout<<"NO"<<endl;
		}

		t++;
	}

	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int max_a, min_a;
int l, r;

bool interesting_subarray( vector<int> &a, int start_A, int end_A){/// 0 ----- (n-1)

	//cout<<"start : "<<start<<"  end:"<<end<<endl;
	int length = end_A -(start_A-1);
	if( length <=1){
		//cout<<"length : "<<length<<endl;
		return false;

	}

	max_a = a[end_A];
	min_a = a[start_A];
	//cout<<"max_a"<<max_a<<endl;
	//cout<<"min_a"<<min_a<<endl;

	if( max_a-min_a >= length ){
	    l = start_A;
	    r = end_A;
		return true;

	}

	return interesting_subarray(a, start_A+1, end_A) || interesting_subarray(a,start_A, end_A-1);

}

int main(){

	int tests_cases;
	cin>>tests_cases;
	///cout<<"test_cases : "<<tests_cases<<endl;
	int t=0;
	while(t< tests_cases){

		int n;
		cin>>n;
		vector<int> a;

		int j=0;

		while(j<n){
			int tmp;
			cin>>tmp;
			a.push_back(tmp);
			j++;
		}
		//cout<<"tamaño :"<<a.size()<<endl;
		sort(a.begin(), a.end());
		bool rpta = interesting_subarray(a, 0, n-1);
		if(rpta){
			cout<<"YES"<<endl;
			cout<<l+1<<" "<<r+1<<endl;

		}
		else{
			cout<<"NO"<<endl;
		}

		t++;
	}

	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define si(n) scanf("%d",&n);
#define PI acos(-1.0)
#define sl(n) scanf("%lld",&n);
#define sf(n) scanf("%lf",&n);
#define ss(n) scanf("%s",n);
#define for0(i,n) for(ll i=0;i<n;i++)
#define for1(i,n) for(ll i=1;i<=n;i++)
#define forc(i,j,n) for(ll i=j;i<n;i++)
#define pb push_back
#define sor(n) sort(n.begin(),n.end())
#define sorcmp(n) sort(n.begin(),n.end(),cmp)
#define rev(n) reverse(n.begin(),n.end())
#define pi(x)  prllf("%d",x);
#define pl(x)  prllf("%lld",x);
#define pf(x)  prllf("%.10lf",x);
#define ps(x)  prllf("%s",x);
#define en() prllf("\n");
void fastio(){ios_base::sync_with_stdio(false);cin.tie(NULL);}

int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        int arr[n];
        int mx=-1,mn=INT_MAX;
        int id1,id2;
        for(int i=0;i<n;i++)
        {
            cin>>arr[i];

            if(arr[i]>mx)
            {
                mx=arr[i];
                id1=i;
            }
            if(arr[i]<mn)
            {
                mn=arr[i];
                id2=i;
            }

        }
        if(abs(mx-mn)<n) cout<<"NO"<<endl;
        else
        {
           for(int i=0;i<n;i++)
           {
               if(abs(arr[i]-mx)>=abs(i-id1) &&id1!=i)
               {
                 if(i>id1) swap(i,id1);
                 cout<<"YES"<<endl;
                 cout<<i+1<<" "<<id1+1<<endl;
                 break;
               }
           }
        }

    }
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define si(n) scanf("%d",&n);
#define PI acos(-1.0)
#define sl(n) scanf("%lld",&n);
#define sf(n) scanf("%lf",&n);
#define ss(n) scanf("%s",n);
#define for0(i,n) for(ll i=0;i<n;i++)
#define for1(i,n) for(ll i=1;i<=n;i++)
#define forc(i,j,n) for(ll i=j;i<n;i++)
#define pb push_back
#define sor(n) sort(n.begin(),n.end())
#define sorcmp(n) sort(n.begin(),n.end(),cmp)
#define rev(n) reverse(n.begin(),n.end())
#define pi(x)  prllf("%d",x);
#define pl(x)  prllf("%lld",x);
#define pf(x)  prllf("%.10lf",x);
#define ps(x)  prllf("%s",x);
#define en() prllf("\n");
void fastio(){ios_base::sync_with_stdio(false);cin.tie(NULL);}

int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        int arr[n];
        int f=0;
        for(int i=0;i<n;i++)
        {
            cin>>arr[i];

        }

        for(int i=0;i<n-1;i++)
        {
           if(abs(arr[i]-arr[i+1])>=2)
           {
               cout<<"YES"<<endl;
               cout<<i+1<<" "<<i+2<<endl;
               f=1;
               break;
           }
        }
        if(f==0)
        {
            cout<<"NO"<<endl;
        }

    }
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define si(n) scanf("%d",&n);
#define PI acos(-1.0)
#define sl(n) scanf("%lld",&n);
#define sf(n) scanf("%lf",&n);
#define ss(n) scanf("%s",n);
#define for0(i,n) for(ll i=0;i<n;i++)
#define for1(i,n) for(ll i=1;i<=n;i++)
#define forc(i,j,n) for(ll i=j;i<n;i++)
#define pb push_back
#define sor(n) sort(n.begin(),n.end())
#define sorcmp(n) sort(n.begin(),n.end(),cmp)
#define rev(n) reverse(n.begin(),n.end())
#define pi(x)  prllf("%d",x);
#define pl(x)  prllf("%lld",x);
#define pf(x)  prllf("%.10lf",x);
#define ps(x)  prllf("%s",x);
#define en() prllf("\n");
void fastio(){ios_base::sync_with_stdio(false);cin.tie(NULL);}

int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        int arr[n];
        int mx=-1,mn=INT_MAX;
        int id1,id2;
        int mr[n];
        int mn2=INT_MAX;
        for(int i=0;i<n;i++)
        {
            cin>>arr[i];

            if(arr[i]>mx)
            {
                mx=arr[i];
                id1=i;
            }

        }
        mn2=INT_MAX;
        int mr2[n];
        for(int i=id1-1;i>=0;i--)
        {
            mn2=min(mn2,arr[i]);
            mr2[i]=mn2;
        }

        mn=INT_MAX;
        for(int i=id1+1;i<n;i++)
        {
            mn=min(mn,arr[i]);
            mr[i]=mn;
        }

           int f=0;
           for(int i=id1+1;i<n;i++)
           {
               if(abs(mr[i]-mx)>=(abs(i-id1)+1))
               {
                 if(i>id1) swap(i,id1);
                 cout<<"YES"<<endl;
                 cout<<i+1<<" "<<id1+1<<endl;
                 f=1;
                 break;

               }
           }
           if(f==0){
           for(int i=id1-1;i>=0;i--)
           {
               //cout<<mr2[i]<<endl;
               if(abs(mr2[i]-mx)>=(abs(i-id1)+1) )
               {
                   if(i>id1) swap(i,id1);
                   cout<<"YES"<<endl;
                   cout<<i+1<<" "<<id1+1<<endl;
                   f=1;
                   break;
               }
           }
           }
           if(f==0)
           {
               cout<<"NO"<<endl;
           }

    }
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define si(n) scanf("%d",&n);
#define PI acos(-1.0)
#define sl(n) scanf("%lld",&n);
#define sf(n) scanf("%lf",&n);
#define ss(n) scanf("%s",n);
#define for0(i,n) for(ll i=0;i<n;i++)
#define for1(i,n) for(ll i=1;i<=n;i++)
#define forc(i,j,n) for(ll i=j;i<n;i++)
#define pb push_back
#define sor(n) sort(n.begin(),n.end())
#define sorcmp(n) sort(n.begin(),n.end(),cmp)
#define rev(n) reverse(n.begin(),n.end())
#define pi(x)  prllf("%d",x);
#define pl(x)  prllf("%lld",x);
#define pf(x)  prllf("%.10lf",x);
#define ps(x)  prllf("%s",x);
#define en() prllf("\n");
void fastio(){ios_base::sync_with_stdio(false);cin.tie(NULL);}

int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        int arr[n];
        int mx=-1,mn=INT_MAX;
        int id1,id2;
        int mr[n];
        int mn2=INT_MAX;
        for(int i=0;i<n;i++)
        {
            cin>>arr[i];

            if(arr[i]>mx)
            {
                mx=arr[i];
                id1=i;
            }
            if(arr[i]<mn)
            {
                mn=arr[i];
                id2=i;
            }

        }
        mn2=INT_MAX;
        int mr2[n];
        for(int i=id1-1;i>=0;i--)
        {
            mn2=min(mn2,arr[i]);
            mr2[i]=mn2;
        }

        mn=INT_MAX;
        for(int i=id1+1;i<n;i++)
        {
            mn=min(mn,arr[i]);
            mr[i]=mn;
        }

           int f=0;
           for(int i=id1+1;i<n;i++)
           {
               if(abs(mr[i]-mx)>=(abs(i-id1)+1) &&arr[i]>=mr[i])
               {
                 if(i>id1) swap(i,id1);
                 cout<<"YES"<<endl;
                 cout<<i+1<<" "<<id1+1<<endl;
                 f=1;
                 break;

               }
           }
           if(f==0){
           for(int i=id1-1;i>=0;i--)
           {
               //cout<<mr2[i]<<endl;
               if(abs(mr2[i]-mx)>=(abs(i-id1)+1) && arr[i]>=mr2[i])
               {
                   if(i>id1) swap(i,id1);
                   cout<<"YES"<<endl;
                   cout<<i+1<<" "<<id1+1<<endl;
                   f=1;
                   break;
               }
           }
           }
           if(f==0)
           {
               cout<<"NO"<<endl;
           }

    }
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define si(n) scanf("%d",&n);
#define PI acos(-1.0)
#define sl(n) scanf("%lld",&n);
#define sf(n) scanf("%lf",&n);
#define ss(n) scanf("%s",n);
#define for0(i,n) for(ll i=0;i<n;i++)
#define for1(i,n) for(ll i=1;i<=n;i++)
#define forc(i,j,n) for(ll i=j;i<n;i++)
#define pb push_back
#define sor(n) sort(n.begin(),n.end())
#define sorcmp(n) sort(n.begin(),n.end(),cmp)
#define rev(n) reverse(n.begin(),n.end())
#define pi(x)  prllf("%d",x);
#define pl(x)  prllf("%lld",x);
#define pf(x)  prllf("%.10lf",x);
#define ps(x)  prllf("%s",x);
#define en() prllf("\n");
void fastio(){ios_base::sync_with_stdio(false);cin.tie(NULL);}

int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        int arr[n];
        int mx=-1,mn=INT_MAX;
        int id1,id2;
        int mr[n];
        int mn2=INT_MAX;
        for(int i=0;i<n;i++)
        {
            cin>>arr[i];

            if(arr[i]>mx)
            {
                mx=arr[i];
                id1=i;
            }
            if(arr[i]<mn)
            {
                mn=arr[i];
                id2=i;
            }

        }
        mn2=INT_MAX;
        int mr2[n];
        for(int i=id1-1;i>=0;i--)
        {
            mn=min(mn,arr[i]);
            mr2[i]=mn;
        }

        for(int i=id1+1;i<n;i++)
        {
            mn=min(mn,arr[i]);
            mr2[i]=mn;
        }

        if(abs(mx-mn)<n) cout<<"NO"<<endl;
        else
        {
           int f=0;
           for(int i=id1+1;i<n;i++)
           {
               if(abs(mr[i]-mx)>=(abs(i-id1)+1) &&arr[i]>=mr[i])
               {
                 if(i>id1) swap(i,id1);
                 cout<<"YES"<<endl;
                 cout<<i+1<<" "<<id1+1<<endl;
                 f=1;
                 break;

               }
           }
           if(f==0){
           for(int i=id1-1;i>=0;i--)
           {
               if(abs(mr2[i]-mx)>=(abs(i-id1)+1) && arr[i]>=mr2[i])
               {
                   if(i>id1) swap(i,id1);
                   cout<<"YES"<<endl;
                   cout<<i+1<<" "<<id1+1<<endl;
                   break;
               }
           }
           }

        }

    }
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define si(n) scanf("%d",&n);
#define PI acos(-1.0)
#define sl(n) scanf("%lld",&n);
#define sf(n) scanf("%lf",&n);
#define ss(n) scanf("%s",n);
#define for0(i,n) for(ll i=0;i<n;i++)
#define for1(i,n) for(ll i=1;i<=n;i++)
#define forc(i,j,n) for(ll i=j;i<n;i++)
#define pb push_back
#define sor(n) sort(n.begin(),n.end())
#define sorcmp(n) sort(n.begin(),n.end(),cmp)
#define rev(n) reverse(n.begin(),n.end())
#define pi(x)  prllf("%d",x);
#define pl(x)  prllf("%lld",x);
#define pf(x)  prllf("%.10lf",x);
#define ps(x)  prllf("%s",x);
#define en() prllf("\n");
void fastio(){ios_base::sync_with_stdio(false);cin.tie(NULL);}

int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        int arr[n];
        int mx=-1,mn=INT_MAX;
        int id1,id2;
        int mr[n];
        int mn2=INT_MAX;
        for(int i=0;i<n;i++)
        {
            cin>>arr[i];

            if(arr[i]>mx)
            {
                mx=arr[i];
                id1=i;
            }
            if(arr[i]<mn)
            {
                mn=arr[i];
                id2=i;
            }

        }
        mn2=INT_MAX;
        int mr2[n];
        for(int i=id1-1;i>=0;i--)
        {
            mn2=min(mn2,arr[i]);
            mr2[i]=mn2;
        }

        for(int i=id1+1;i<n;i++)
        {
            mn=min(mn,arr[i]);
            mr2[i]=mn;
        }

           int f=0;
           for(int i=id1+1;i<n;i++)
           {
               if(abs(mr[i]-mx)>=(abs(i-id1)+1) &&arr[i]>=mr[i])
               {
                 if(i>id1) swap(i,id1);
                 cout<<"YES"<<endl;
                 cout<<i+1<<" "<<id1+1<<endl;
                 f=1;
                 break;

               }
           }
           if(f==0){
           for(int i=id1-1;i>=0;i--)
           {
               //cout<<mr2[i]<<endl;
               if(abs(mr2[i]-mx)>=(abs(i-id1)+1) && arr[i]>=mr2[i])
               {
                   if(i>id1) swap(i,id1);
                   cout<<"YES"<<endl;
                   cout<<i+1<<" "<<id1+1<<endl;
                   f=1;
                   break;
               }
           }
           }
           if(f==0)
           {
               cout<<"NO"<<endl;
           }

    }
}


#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cstdlib>
using namespace std;
int f[1005];
int g[1005];
int a[1005],b[1005],p[1005];
int t1,t2,n;
bool ok(int a[],int b[],int i)
{
    for(int j=1;j<=n;j++)
        p[j]=b[j];
    p[i]=t2;
    int k1=0,k2=0;
    for(int j=1;j<=n;j++)
    {
        if(p[j]!=a[j]) k1++;
        if(p[j]!=b[j]) k2++;
    }
    if(k1!=1||k2!=1)
        return false;
    return true;
}

int main()
{
    memset(f,0,sizeof(f));
    memset(g,0,sizeof(g));
    scanf("%d",&n);
    for(int i=1; i<=n; i++)
        scanf("%d",&a[i]);
    for(int i=1; i<=n; i++)
        scanf("%d",&b[i]);
    for(int i=1; i<=n; i++)
        f[a[i]]++;
    for(int i=1; i<=n; i++)
        g[b[i]]++;
    for(int i=1; i<=n; i++)
    {
        if(f[i]==0)
            t1=i;
        if(g[i]==0)
            t2=i;
    }
    if(t1==t2)
    {
        for(int i=1; i<=n; i++)
        {
            if(g[b[i]]==2) {b[i]=t1;break;}
        }
        for(int i=1;i<=n;i++)
            p[i]=b[i];
    }
    else
    {
        for(int i=1; i<=n; i++)
        {
            if(g[b[i]]==2)
            {
                if(ok(a,b,i))
                    break;
                else continue;
            }
        }
    }

    for(int i=1;i<n;i++)
    {
        printf("%d ",p[i]);
    }
    printf("%d\n",p[n]);
    return 0;
}


#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cstdlib>
using namespace std;
int f[1005];
int g[1005];
int a[1005],b[1005],p[1005];
int q[1005];
int t1,t2,n;
bool ok(int i)
{
    for(int j=1;j<=n;j++)
        p[j]=b[j];
    p[i]=t2;
    int k1=0,k2=0,qq=1;
    memset(q,0,sizeof(q));
    for(int j=1;j<=n;j++)
    {
        if(p[j]!=a[j]) k1++;
        if(p[j]!=b[j]) k2++;
    }
    if(k1!=1||k2!=1)
        return false;
    for(int j=1;j<=n;j++)
    {
        q[p[j]]++;
    }
    for(int j=1;j<=n;j++)
    {
        if(q[j]==0) qq=0;
    }
    if(qq=0) return false;
    return true;
}

int main()
{
    memset(f,0,sizeof(f));
    memset(g,0,sizeof(g));
    scanf("%d",&n);
    for(int i=1; i<=n; i++)
        scanf("%d",&a[i]);
    for(int i=1; i<=n; i++)
        scanf("%d",&b[i]);
    for(int i=1; i<=n; i++)
        f[a[i]]++;
    for(int i=1; i<=n; i++)
        g[b[i]]++;
    for(int i=1; i<=n; i++)
    {
        if(f[i]==0)
            t1=i;
        if(g[i]==0)
            t2=i;
    }
    /*if(t1==t2)
    {
        for(int i=1; i<=n; i++)
        {
            if(g[b[i]]==2)
            {
                if(ok(i))
            }
        }
        for(int i=1;i<=n;i++)
            p[i]=b[i];
    }*/
    //else
    //{
        for(int i=1; i<=n; i++)
        {
            if(g[b[i]]==2)
            {
                if(ok(i))
                    break;
                else continue;
            }
        }
    //}

    for(int i=1;i<n;i++)
        printf("%d ",p[i]);
    printf("%d\n",p[n]);
    return 0;
}


#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cstdlib>
using namespace std;
int g[1005];
int a[1005],b[1005],p[1005];
int q[1005];
int t2,n;
bool ok(int i)
{
    for(int j=1;j<=n;j++)
        p[j]=b[j];
    p[i]=t2;
    int k1=0,k2=0,qq=1;
    memset(q,0,sizeof(q));
    for(int j=1;j<=n;j++)
    {
        if(p[j]!=a[j]) k1++;
        if(p[j]!=b[j]) k2++;
    }
    if(k1!=1||k2!=1)
        return false;

    return true;
}

int main()
{
    memset(g,0,sizeof(g));
    scanf("%d",&n);
    for(int i=1; i<=n; i++)
        scanf("%d",&a[i]);
    for(int i=1; i<=n; i++)
        scanf("%d",&b[i]);
    for(int i=1; i<=n; i++)
        g[b[i]]++;
    for(int i=1; i<=n; i++)
    {
        if(g[i]==0)
            t2=i;
    }
    for(int i=1; i<=n; i++)
    {
        if(g[b[i]]==2)
        {
            if(ok(i))
                break;
            else continue;
        }
    }
    for(int i=1;i<n;i++)
        printf("%d ",p[i]);
    printf("%d\n",p[n]);
    return 0;
}


#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cstdlib>
using namespace std;
int g[1005];
int a[1005],b[1005],p[1005];
int q[1005];
int t1,t2,n;
bool ok(int i)
{
    for(int j=1;j<=n;j++)
        p[j]=b[j];
    p[i]=t2;
    int k1=0,k2=0,qq=1;
    memset(q,0,sizeof(q));
    for(int j=1;j<=n;j++)
    {
        if(p[j]!=a[j]) k1++;
        if(p[j]!=b[j]) k2++;
    }
    if(k1!=1||k2!=1)
        return false;
    /*for(int j=1;j<=n;j++)
    {
        q[p[j]]++;
    }
    for(int j=1;j<=n;j++)
    {
        if(q[j]==0) qq=0;
    }
    if(qq=0) return false;*/
    return true;
}

int main()
{
    memset(f,0,sizeof(f));
    memset(g,0,sizeof(g));
    scanf("%d",&n);
    for(int i=1; i<=n; i++)
        scanf("%d",&a[i]);
    for(int i=1; i<=n; i++)
        scanf("%d",&b[i]);
    for(int i=1; i<=n; i++)
        g[b[i]]++;
    for(int i=1; i<=n; i++)
    {
        if(g[i]==0)
            t2=i;
    }
    for(int i=1; i<=n; i++)
    {
        if(g[b[i]]==2)
        {
            if(ok(i))
                break;
            else continue;
        }
    }
    for(int i=1;i<n;i++)
        printf("%d ",p[i]);
    printf("%d\n",p[n]);
    return 0;
}


#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cstdlib>
using namespace std;
int g[1005];
int a[1005],b[1005],p[1005];
int q[1005];
int t1,t2,n;
bool ok(int i)
{
    for(int j=1;j<=n;j++)
        p[j]=b[j];
    p[i]=t2;
    int k1=0,k2=0,qq=1;
    memset(q,0,sizeof(q));
    for(int j=1;j<=n;j++)
    {
        if(p[j]!=a[j]) k1++;
        if(p[j]!=b[j]) k2++;
    }
    if(k1!=1||k2!=1)
        return false;

    return true;
}

int main()
{
    memset(f,0,sizeof(f));
    memset(g,0,sizeof(g));
    scanf("%d",&n);
    for(int i=1; i<=n; i++)
        scanf("%d",&a[i]);
    for(int i=1; i<=n; i++)
        scanf("%d",&b[i]);
    for(int i=1; i<=n; i++)
        g[b[i]]++;
    for(int i=1; i<=n; i++)
    {
        if(g[i]==0)
            t2=i;
    }
    for(int i=1; i<=n; i++)
    {
        if(g[b[i]]==2)
        {
            if(ok(i))
                break;
            else continue;
        }
    }
    for(int i=1;i<n;i++)
        printf("%d ",p[i]);
    printf("%d\n",p[n]);
    return 0;
}


#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <set>
using namespace std;
int f[1005];
int g[1005];
int a[1005],b[1005],p[1005];
int t1,t2,n;
bool ok(int a[],int b[],int i)
{
    for(int j=1;j<=n;j++)
        p[j]=b[j];
    p[i]=t2;
    int k1=0,k2=0;
    for(int j=1;j<=n;j++)
    {
        if(p[j]!=a[j]) k1++;
        if(p[j]!=b[j]) k2++;
    }
    if(k1!=1||k2!=1)
        return false;
    return true;
}

int main()
{
    memset(f,0,sizeof(f));
    memset(g,0,sizeof(g));
    scanf("%d",&n);
    for(int i=1; i<=n; i++)
        scanf("%d",&a[i]);
    for(int i=1; i<=n; i++)
        scanf("%d",&b[i]);
    for(int i=1; i<=n; i++)
        f[a[i]]++;
    for(int i=1; i<=n; i++)
        g[b[i]]++;
    for(int i=1; i<=n; i++)
    {
        if(f[i]==0)
            t1=i;
        if(g[i]==0)
            t2=i;
    }
    if(t1==t2)
    {
        for(int i=1; i<=n; i++)
        {
            if(g[b[i]]==2) {b[i]=t1;break;}
        }
        for(int i=1;i<=n;i++)
            p[i]=b[i];
    }
    else
    {
        for(int i=1; i<=n; i++)
        {
            if(g[b[i]]==2)
            {
                if(ok(a,b,i))
                    break;
                else continue;
            }
        }
    }

    for(int i=1;i<n;i++)
    {
        printf("%d ",p[i]);
    }
    printf("%d\n",p[n]);
    return 0;
}


#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <set>
using namespace std;
int f[1005];
int g[1005];
int a[1005],b[1005];
int main()
{
    set <int> s;
    int n;
    memset(f,0,sizeof(f));
    memset(g,0,sizeof(g));
    scanf("%d",&n);
    for(int i=1; i<=n; i++)
        scanf("%d",&a[i]);
    for(int i=1; i<=n; i++)
        scanf("%d",&b[i]);
    for(int i=1; i<=n; i++)
        f[a[i]]++;
    for(int i=1; i<=n; i++)
        g[b[i]]++;
    int t1,t2;
    for(int i=1; i<=n; i++)
    {
        if(f[i]==0)
            t1=i;
        if(g[i]==0)
            t2=i;
    }
    if(t1==t2)
    {
        for(int i=1; i<=n; i++)
        {
            if(g[b[i]]==2) b[i]=t1;
        }
    }
    else
    {
        for(int i=1; i<=n; i++)
        {
            if(b[i]==t1)
                {b[i]=t2;break;}
        }
    }
    for(int i=1;i<n;i++)
    {
        printf("%d ",b[i]);
    }
    printf("%d\n",b[n]);

    return 0;
}


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

int main(){
	ios_base::sync_with_stdio(false);
	int n, k;
	cin>>n;
	int a[n], p[n];
	int b[n];
	bool t0[n];
	for (int i = 0; i < n; ++i)
	{
		cin>>a[i];
		p[i] = 0;
		t0[i] = false;
	}
	int count = 0;
	int diff[10] = {0}, mv[10] = {0};
	int j0 = 0, j1 = 0;
	for (int i = 0; i < n; ++i)
	{
		cin>>b[i];
		if(a[i] != b[i]){
			count++;
			diff[j0] = i;
			j0++;

		}
		else{
			p[i] = a[i];
			t0[a[i]-1] = true;
		}
	}
	for (int i = 0; i < n; ++i){
		if( !t0[i] ){
			mv[j1] = i+1;
			j1++;
		}
	}
	if(count&1){////// 3 4 ka case
		int temp = diff[0];
		p[temp] = mv[0];

	}
	else{
		int temp1 = diff[0];
		int temp2 = diff[1];
		if((a[temp1] == a[temp2]) && (b[temp1] == b[temp2])){
			p[temp1] = mv[0];
			p[temp2] = mv[1];
		}
		else if(a[temp1] == a[temp2]){
			if(b[temp1] == mv[0] || b[temp2] == mv[1]){
				p[temp1] = mv[0];
				p[temp2] = mv[1];
			}
			else if(b[temp1] == mv[1] || b[temp2] == mv[0]){
				p[temp2] = mv[0];
				p[temp1] = mv[1];
			}
		}
		else if(b[temp1] == b[temp2]){
			if(a[temp1] == mv[0] || a[temp2] == mv[1]){
				p[temp1] = mv[0];
				p[temp2] = mv[1];
			}
			else if(a[temp1] == mv[1] || a[temp2] == mv[0]){
				p[temp2] = mv[0];
				p[temp1] = mv[1];
			}
		}
		else{
			p[temp1] = mv[0];
			p[temp2] = mv[1];
		}
	}
	for (int i = 0; i < n; ++i)
	{
		cout<<p[i]<<" ";
	}
	cout<<endl;
	return 0;
}


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

int main(){
	ios_base::sync_with_stdio(false);
	int n, k;
	cin>>n;
	int a[n], p[n];
	int b[n];
	bool t0[n];
	for (int i = 0; i < n; ++i)
	{
		cin>>a[i];
		p[i] = 0;
		t0[i] = false;
	}
	int count = 0;
	int diff[10] = {0}, mv[10] = {0};
	int j0 = 0, j1 = 0;
	for (int i = 0; i < n; ++i)
	{
		cin>>b[i];
		if(a[i] != b[i]){
			count++;
			diff[j0] = i;
			j0++;

		}
		else{
			p[i] = a[i];
			t0[a[i]-1] = true;
		}
	}
	for (int i = 0; i < n; ++i){
		if( !t0[i] ){
			mv[j1] = i+1;
			j1++;
		}
	}
	if(count&1){////// 3 4 ka case
		int temp = diff[0];
		p[temp] = mv[0];

	}
	else{
		int temp1 = diff[0];
		int temp2 = diff[1];
		if((a[temp1] == a[temp2]) && (b[temp1] == b[temp2])){
			p[temp1] = mv[0];
			p[temp2] = mv[1];
		}
		else if(a[temp1] == a[temp2]){
			if(b[temp1] == mv[0] || b[temp2] == mv[1]){
				p[temp1] = mv[0];
				p[temp2] = mv[1];
			}
			else if(b[temp1] == mv[1] || b[temp2] == mv[0]){
				p[temp2] = mv[0];
				p[temp1] = mv[1];
			}
		}
		else if(b[temp1] == b[temp2]){
			if(a[temp1] == mv[0] || a[temp2] == mv[1]){
				p[temp1] = mv[0];
				p[temp2] = mv[1];
			}
			else if(a[temp1] == mv[1] || a[temp2] == mv[0]){
				p[temp2] = mv[0];
				p[temp1] = mv[1];
			}
		}
	}
	for (int i = 0; i < n; ++i)
	{
		cout<<p[i]<<" ";
	}
	cout<<endl;
	return 0;
}


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

int main(){
	ios_base::sync_with_stdio(false);
	int n, k;
	cin>>n;
	int a[n], p[n];
	int b[n];
	bool t0[n];
	for (int i = 0; i < n; ++i)
	{
		cin>>a[i];
		p[i] = 0;
		t0[i] = false;
	}
	int count = 0;
	int diff[10] = {0}, mv[10] = {0};
	int j0 = 0, j1 = 0;
	for (int i = 0; i < n; ++i)
	{
		cin>>b[i];
		if(a[i] != b[i]){
			count++;
			diff[j0] = i;
			j0++;

		}
		else{
			p[i] = a[i];
			t0[a[i]-1] = true;
		}
	}
	for (int i = 0; i < n; ++i){
		if( !t0[i] ){
			mv[j1] = i+1;
			j1++;
		}
	}
	if(count&1){////// 3 4 ka case
		int temp = diff[0];
		p[temp] = mv[0];

	}
	else{
		int temp1 = diff[0];
		int temp2 = diff[1];
		if((a[temp1] == a[temp2]) && (b[temp1] == b[temp2])){
			p[temp1] = mv[0];
			p[temp2] = mv[1];
		}
		else if(a[temp1] == a[temp2]){
			if(b[temp1] == mv[0] || b[temp2] == mv[1]){
				p[temp1] = mv[0];
				p[temp2] = mv[1];
			}
			else if(b[temp1] == mv[1] || b[temp2] == mv[0]){
				p[temp2] = mv[0];
				p[temp1] = mv[1];
			}
		}
		else if(b[temp1] == b[temp2]){
			if(a[temp1] == mv[0] || a[temp2] == mv[1]){
				p[temp1] = mv[0];
				p[temp2] = mv[1];
			}
			else if(a[temp1] == mv[1] || a[temp2] == mv[0]){
				p[temp2] = mv[0];
				p[temp1] = mv[1];
			}
		}
		else{
			if(b[temp1] == mv[0] || b[temp2] == mv[1]){
				p[temp1] = mv[0];
				p[temp2] = mv[1];
			}
			else if(b[temp1] == mv[1] || b[temp2] == mv[0]){
				p[temp2] = mv[0];
				p[temp1] = mv[1];
			}
			else if(a[temp1] == mv[0] || a[temp2] == mv[1]){
				p[temp1] = mv[0];
				p[temp2] = mv[1];
			}
			else if(a[temp1] == mv[1] || a[temp2] == mv[0]){
				p[temp2] = mv[0];
				p[temp1] = mv[1];
			}
			else{
				p[temp1] = mv[0];
				p[temp2] = mv[1];
			}

		}
	}
	for (int i = 0; i < n; ++i)
	{
		cout<<p[i]<<" ";
	}
	cout<<endl;
	return 0;
}


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

int main(){
	ios_base::sync_with_stdio(false);
	int n, k;
	cin>>n;
	int a[n], p[n];
	int b[n];
	bool t0[n];
	for (int i = 0; i < n; ++i)
	{
		cin>>a[i];
		p[i] = 0;
		t0[i] = false;
	}
	int count = 0;
	int diff[10] = {0}, mv[10] = {0};
	int j0 = 0, j1 = 0;
	for (int i = 0; i < n; ++i)
	{
		cin>>b[i];
		if(a[i] != b[i]){
			count++;
			diff[j0] = i;
			j0++;

		}
		else{
			p[i] = a[i];
			t0[a[i]-1] = true;
		}
	}
	for (int i = 0; i < n; ++i){
		if( !t0[i] ){
			mv[j1] = i+1;
			j1++;
		}
	}
	if(count&1){////// 3 4 ka case
		int temp = diff[0];
		p[temp] = mv[0];

	}
	else{
		int temp1 = diff[0];
		int temp2 = diff[1];
		if((a[temp1] == a[temp2]) && (b[temp1] == b[temp2])){
			p[temp1] = mv[0];
			p[temp2] = mv[1];
		}
		else if(a[temp1] == a[temp2]){
			if(b[temp1] == mv[0] || b[temp2] == mv[1]){
				p[temp1] = mv[0];
				p[temp2] = mv[1];
			}
			else if(b[temp1] == mv[1] || b[temp2] == mv[0]){
				p[temp2] = mv[0];
				p[temp1] = mv[1];
			}
		}
		else if(b[temp1] == b[temp2]){
			if(a[temp1] == mv[0] || a[temp2] == mv[1]){
				p[temp1] = mv[0];
				p[temp2] = mv[1];
			}
			else if(a[temp1] == mv[1] || a[temp2] == mv[0]){
				p[temp2] = mv[0];
				p[temp1] = mv[1];
			}
		}
		else{
			p[temp1] = mv[0];
			p[temp2] = mv[1];
			if(b[temp1] == mv[0] || b[temp2] == mv[1]){
				p[temp1] = mv[0];
				p[temp2] = mv[1];
				continue;
			}
			else if(b[temp1] == mv[1] || b[temp2] == mv[0]){
				p[temp2] = mv[0];
				p[temp1] = mv[1];
				continue;
			}
			if(a[temp1] == mv[0] || a[temp2] == mv[1]){
				p[temp1] = mv[0];
				p[temp2] = mv[1];
				continue;
			}
			else if(a[temp1] == mv[1] || a[temp2] == mv[0]){
				p[temp2] = mv[0];
				p[temp1] = mv[1];
				continue;
			}
		}
	}
	for (int i = 0; i < n; ++i)
	{
		cout<<p[i]<<" ";
	}
	cout<<endl;
	return 0;
}


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

int main(){
	ios_base::sync_with_stdio(false);
	int n, k;
	cin>>n;
	int a[n], p[n];
	int b[n];
	for (int i = 0; i < n; ++i)
	{
		cin>>a[i];
		p[i] = 0;
	}
	int count = 0;
	int diff[10] = {0};
	int j0 = 0;
	for (int i = 0; i < n; ++i)
	{
		cin>>b[i];
		if(a[i] != b[i]){
			count++;
			diff[j0] = i;
			j0++;
		}
		else
			p[i] = a[i];
	}
	if(count&1){
		int temp = diff[0];
		if((a[temp] - b[temp] >= 2) || (b[temp] - a[temp] >= 2))
			p[temp] = (a[temp] + b[temp])/2;
		else{
			p[temp] = (a[temp] + b[temp])/2;
			if ((p[temp] == a[temp] || p[temp] == b[temp]) && (p[temp] > 0))
				p[temp]--;
			else
				p[temp] += 2;
		}
	}
	else{
		int temp1 = diff[0];
		int temp2 = diff[1];
		p[temp1] = a[temp1];
		p[temp2] = b[temp2];
	}
	for (int i = 0; i < n; ++i)
	{
		cout<<p[i]<<" ";
	}
	cout<<endl;
	return 0;
}


#include <iostream>
using namespace std;

void SortShell(short *arr,short ns){
  int m=ns,p=0;
  while (m>0){
    m/=2;
    for (int j=0;j<ns;j++){
        if (j+m<ns){
                p=j;
                if (arr[p]>arr[p+m]){
                swap (arr[p],arr[p+m]);
                while (p-m>=0){
                      if (arr[p] <arr[p-m]){swap (arr[p],arr[p-m]);p-=m;}else break;
                  }
                }
        }else break;
    }
  }
}

int main(){

short n=0;
cin>>n;
short  *a=new short [n];
short  *b=new short [n];
short  *c=new short [n];
short *metka=new short [n];

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

for(int i=0;i<n;i++){
    c[a[i]-1]++;
    cin>>b[i];
}

for(int i=0;i<n;i++){
    if(c[b[i]-1]==0 && c[a[i]-1]>1){c[a[i]-1]--;a[i]=b[i];}
}
int lk=0;
for(int i=0;i<n;i++){
    if(c[a[i]-1]>1)lk++;
}
if(lk>0){
        lk=0;
    for(int i=1;i<=n;i++){
        if(c[i-1]==0){c[i-1]=i;metka[lk]=i;lk++;}
    }
lk=0;
    for(int i=0;i<n;i++){
        if(c[a[i]-1]>1){c[a[i]-1]--;a[i]=c[metka[lk]-1];lk++;}
    }
    bool f=false;
    for(int i=0;i<n-1;i++){
        if(a[i]<a[i+1])f=true;break;
    }
    if (f)SortShell(a,n);
}

for(int i=0;i<n;i++){
    cout<<a[i]<<" ";
}
delete []metka;
delete []c;
delete []a;
delete []b;
return 0;
}


#include <iostream>
using namespace std;

void SortShell(short *arr,short ns){
  int m=ns,p=0;
  while (m>0){
    m/=2;
    for (int j=0;j<ns;j++){
        if (j+m<ns){
                p=j;
                if (arr[p]>arr[p+m] ){
                swap (arr[p],arr[p+m]);
                while (p-m>=0){
                      if (arr[p] <arr[p-m] ){swap (arr[p],arr[p-m]);p-=m;}else break;
                  }
                }
        }else break;
    }
  }
}

int main(){

short n=0;
cin>>n;
short  *a=new short [n];
short  *b=new short [n];
short  *c=new short [n];
short  *metka=new short [n];
short  *d=new short [n];

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

for(int i=0;i<n;i++){
    c[a[i]-1]++;
    cin>>b[i];
}

for(int i=0;i<n;i++){
    if(c[b[i]-1]==0 && c[a[i]-1]>1){c[a[i]-1]--;a[i]=b[i];}
}
int lk=0;
for(int i=0;i<n;i++){
    d[i]=c[a[i]-1];
    metka[i]=0;
    if(c[a[i]-1]>1)lk++;
}

if(lk>0){
        int z=0,zz=0,kz=0,kzz=0;
    for(int i=0;i<n-1;i++){
        if( a[i]<a[i+1] )z++; else zz++;
    }
    if(z>zz){
       for(int i=1;i<=n;i++){
            if(c[i-1]==0){metka[kz]=i;kz++;lk--;}
            if (lk==0)break;
        }
        for(int i=0;i<n;i++){
            if(c[a[i]-1]>1){c[a[i]-1]=0;metka[kz]=a[i];kz++;}
            if(d[a[i]-1]>1){a[i]=0;}
        }
        kz=0;
        SortShell(metka,n);
        for(int i=0;i<n;i++){
            if(a[i]==0){
                while(metka[kz]==0){
                    kz++;
                }
                a[i]=metka[kz];kz++;
            }
        }
    }else{
        for(int i=n;i>=1;i++){
            if(c[i-1]==0){metka[kz]=i;kz++;lk--;}
             if(lk==0)break;
        }
        for(int i=0;i<n;i++){
            if(c[a[i]-1]>1){c[a[i]-1]=0;metka[kz]=a[i];kz++;}
            if(d[a[i]-1]>1){a[i]=0;}
        }
        kz=n-1;
        SortShell(metka,n);
        for(int i=n-1;i>=0;i++){
            if(a[i]==0){
                while(d[kz]==0){
                    kz--;
                }
                a[i]=d[kz];kz--;
            }
        }
    }
    }

for(int i=0;i<n;i++){
    cout<<a[i]<<" ";
}
delete []metka;
delete []c;
delete []a;
delete []b;
return 0;
}


#include <iostream>
using namespace std;

void SortShell(short *arr,short ns){
  int m=ns,p=0;
  while (m>0){
    m/=2;
    for (int j=0;j<ns;j++){
        if (j+m<ns){
                p=j;
                if (arr[p]>arr[p+m]){
                swap (arr[p],arr[p+m]);
                while (p-m>=0){
                      if (arr[p] <arr[p-m]){swap (arr[p],arr[p-m]);p-=m;}else break;
                  }
                }
        }else break;
    }
  }
}

int main(){

short n=0;
cin>>n;
short  *a=new short [n];
short  *b=new short [n];
short  *c=new short [n];
short *metka=new short [n];

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

for(int i=0;i<n;i++){
    c[a[i]-1]++;
    cin>>b[i];
}

for(int i=0;i<n;i++){
    if(c[b[i]-1]==0 && c[a[i]-1]>1){c[a[i]-1]--;a[i]=b[i];}
}
int lk=0;
for(int i=0;i<n;i++){
    if(c[a[i]-1]>1)lk++;
}
if(lk>0){
        lk=0;
    for(int i=1;i<=n;i++){
        if(c[i-1]==0){c[i-1]=i;metka[lk]=i;lk++;}
    }
lk=0;
    for(int i=0;i<n;i++){
        if(c[a[i]-1]>1){c[a[i]-1]--;a[i]=c[metka[lk]-1];lk++;}
    }
    bool f=false;
    for(int i=0;i<n-1;i++){
        if( a[i]<a[i+1]     ){f=true;break;}
    }
    if (f)SortShell(a,n);
}

for(int i=0;i<n;i++){
    cout<<a[i]<<" ";
}
delete []metka;
delete []c;
delete []a;
delete []b;
return 0;
}


#include <iostream>
using namespace std;

int main(){

short n=0;
cin>>n;
short  *a=new short [n];
short  *b=new short [n];
short  *c=new short [n];
short *metka=new short [n];

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

for(int i=0;i<n;i++){
    c[a[i]-1]++;
    cin>>b[i];
}

for(int i=0;i<n;i++){
    if(c[b[i]-1]==0 && c[a[i]-1]>1){c[a[i]-1]--;a[i]=b[i];}
}
int lk=0;
for(int i=0;i<n;i++){
    if(c[a[i]-1]>1)lk++;
}
if(lk>0){
        lk=0;
    for(int i=1;i<=n;i++){
        if(c[i-1]==0){c[i-1]=i;metka[lk]=i;lk++;}
    }
lk=0;bool f=false;
    for(int i=0;i<n;i++){
        if(c[a[i]-1]>1){
            if(f) {c[a[i]-1]--;a[i]=c[metka[lk]-1];lk++;f=false;}
            f=true;
    }
    }
}

for(int i=0;i<n;i++){
    cout<<a[i]<<" ";
}
delete []metka;
delete []c;
delete []a;
delete []b;
return 0;
}


#include <iostream>
using namespace std;

void SortShell(short *arr,short ns){
  int m=ns,p=0;
  while (m>0){
    m/=2;
    for (int j=0;j<ns;j++){
        if (j+m<ns){
                p=j;
                if (arr[p]>arr[p+m] ){
                swap (arr[p],arr[p+m]);
                while (p-m>=0){
                      if (arr[p] <arr[p-m] ){swap (arr[p],arr[p-m]);p-=m;}else break;
                  }
                }
        }else break;
    }
  }
}

int main(){

short n=0;
cin>>n;
short  *a=new short [n];
short  *b=new short [n];
short  *c=new short [n];
short  *metka=new short [n];
short  *d=new short [n];

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

for(int i=0;i<n;i++){
    c[a[i]-1]++;
    cin>>b[i];
}

for(int i=0;i<n;i++){
    if(c[b[i]-1]==0 && c[a[i]-1]>1){c[a[i]-1]--;a[i]=b[i];}
}
int lk=0;
for(int i=0;i<n;i++){
    d[a[i]-1]=c[a[i]-1];
    metka[i]=0;
    if(c[a[i]-1]>1)lk++;
}
if(lk>0){
        int z=0,zz=0,kz=0,kzz=0;
    for(int i=0;i<n-1;i++){
        if( a[i]<a[i+1] )z++; else zz++;
    }
       for(int i=1;i<=n;i++){
            if(c[i-1]==0){metka[kz]=i;kz++;lk--;}
            if (lk==1)break;
        }
    if(z>=zz){
        for(int i=0;i<n;i++){
            if(c[a[i]-1]>1){c[a[i]-1]=0;metka[kz]=a[i];kz++;}
            if(d[a[i]-1]>1){a[i]=0;}
        }
        kz=0;
        SortShell(metka,n);
        for(int i=0;i<n;i++){
            if(a[i]==0){
                   while(metka[kz]==0){
                    kz++;
                }
                a[i]=metka[kz];kz++;
            }
        }
    }else{
        for(int i=0;i<n;i++){
            if(c[a[i]-1]>1){c[a[i]-1]=0;metka[kz]=a[i];kz++;}
            if(d[a[i]-1]>1){a[i]=0;}
        }
        kz=n-1;
        SortShell(metka,n);
        for(int i=0;i<n;i++){
            if(a[i]==0){
                while(metka[kz]==0){
                    kz--;
                }
                a[i]=metka[kz];kz--;
            }
        }
    }
}

for(int i=0;i<n;i++){
    cout<<a[i]<<" ";
}
delete []metka;
delete []c;
delete []a;
delete []b;
return 0;
}


#include <iostream>
using namespace std;

void SortShell(short *arr,short ns){
  int m=ns,p=0;
  while (m>0){
    m/=2;
    for (int j=0;j<ns;j++){
        if (j+m<ns){
                p=j;
                if (arr[p]>arr[p+m] ){
                swap (arr[p],arr[p+m]);
                while (p-m>=0){
                      if (arr[p] <arr[p-m] ){swap (arr[p],arr[p-m]);p-=m;}else break;
                  }
                }
        }else break;
    }
  }
}

int main(){

short n=0;
cin>>n;
short  *a=new short [n];
short  *b=new short [n];
short  *c=new short [n];
short  *metka=new short [n];
short  *d=new short [n];

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

for(int i=0;i<n;i++){
    c[a[i]-1]++;
    cin>>b[i];
}

for(int i=0;i<n;i++){
    if(c[b[i]-1]==0 && c[a[i]-1]>1){c[a[i]-1]--;a[i]=b[i];}
}
int lk=0;
for(int i=0;i<n;i++){
    d[a[i]-1]=c[a[i]-1];
    metka[i]=0;
    if(c[a[i]-1]>1)lk++;
}
if(lk>0){
        int z=0,zz=0,kz=0,kzz=0;
    for(int i=0;i<n-1;i++){
        if( a[i]<a[i+1] )z++; else zz++;
    }
    if(z>=zz){
       for(int i=1;i<=n;i++){
            if(c[i-1]==0){metka[kz]=i;kz++;lk--;}
            if (lk==0)break;
        }
        for(int i=0;i<n;i++){
            if(c[a[i]-1]>1){c[a[i]-1]=0;metka[kz]=a[i];kz++;}
            if(d[a[i]-1]>1){a[i]=0;}
        }
        kz=0;
        SortShell(metka,n);
        for(int i=0;i<n;i++){
            if(a[i]==0){
              /*  while(metka[kz]==0){
                    kz++;
                }*/
                a[i]=metka[kz];kz++;
            }
        }
    }else{
        for(int i=n;i>=1;i--){
            if(c[i-1]==0){metka[kz]=i;kz++;lk--;}
             if(lk==0)break;
        }
        for(int i=0;i<n;i++){
            if(c[a[i]-1]>1){c[a[i]-1]=0;metka[kz]=a[i];kz++;}
            if(d[a[i]-1]>1){a[i]=0;}
        }
        kz=n-1;
        SortShell(metka,n);
        for(int i=0;i<n;i++){
            if(a[i]==0){
               /* while(metka[kz]==0){
                    kz--;
                }*/
                a[i]=metka[kz];kz--;
            }
        }
    }
    }

for(int i=0;i<n;i++){
    cout<<a[i]<<" ";
}
delete []metka;
delete []c;
delete []a;
delete []b;
return 0;
}


#include <iostream>
using namespace std;

int main(){

short n=0;
cin>>n;
short  *a=new short [n];
short  *b=new short [n];
short  *c=new short [n];
short *metka=new short [n];

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

for(int i=0;i<n;i++){
    c[a[i]-1]++;
    cin>>b[i];
}

for(int i=0;i<n;i++){
    if(c[b[i]-1]==0 && c[a[i]-1]>1){c[a[i]-1]--;a[i]=b[i];}
}
int lk=0;
for(int i=0;i<n;i++){
    if(c[a[i]-1]>1)lk++;
}
if(lk>0){
        lk=0;
    for(int i=1;i<=n;i++){
        if(c[i-1]==0){c[i-1]=i;metka[lk]=i;lk++;}
    }
lk=0;
    for(int i=0;i<n;i++){
        if(c[a[i]-1]>1){c[a[i]-1]--;a[i]=c[metka[lk]-1];lk++;}
    }
}

for(int i=0;i<n;i++){
    cout<<a[i]<<" ";
}
delete []metka;
delete []c;
delete []a;
delete []b;
return 0;
}


#include <iostream>
using namespace std;

void SortShell(short *arr,short ns){
  int m=ns,p=0;
  while (m>0){
    m/=2;
    for (int j=0;j<ns;j++){
        if (j+m<ns){
                p=j;
                if (arr[p]>arr[p+m] ){
                swap (arr[p],arr[p+m]);
                while (p-m>=0){
                      if (arr[p] <arr[p-m] ){swap (arr[p],arr[p-m]);p-=m;}else break;
                  }
                }
        }else break;
    }
  }
}

int main(){

short n=0;
cin>>n;
short  *a=new short [n];
short  *b=new short [n];
short  *c=new short [n];
short  *metka=new short [n];
short  *d=new short [n];

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

for(int i=0;i<n;i++){
    c[a[i]-1]++;
    cin>>b[i];
}

for(int i=0;i<n;i++){
    if(c[b[i]-1]==0 && c[a[i]-1]>1){c[a[i]-1]--;a[i]=b[i];}
}
int lk=0;
for(int i=0;i<n;i++){
    d[i]=c[a[i]-1];
    metka[i]=0;
    if(c[a[i]-1]>1)lk++;
}
if(lk>0){
        int z=0,zz=0,kz=0,kzz=0;
    for(int i=0;i<n-1;i++){
        if( a[i]<a[i+1] )z++; else zz++;
    }
    if(z>zz){
       for(int i=1;i<=n;i++){
            if(c[i-1]==0){metka[kz]=i;kz++;lk--;}
            if (lk==0)break;
        }
        for(int i=0;i<n;i++){
            if(c[a[i]-1]>1){c[a[i]-1]=0;metka[kz]=a[i];kz++;}
            if(d[a[i]-1]>1){a[i]=0;}
        }
        kz=0;
        SortShell(metka,n);
        for(int i=0;i<n;i++){
            if(a[i]==0){
                while(metka[kz]==0){
                    kz++;
                }
                a[i]=metka[kz];kz++;
            }
        }
    }else{
        for(int i=n;i>=1;i--){
            if(c[i-1]==0){metka[kz]=i;kz++;lk--;}
             if(lk==0)break;
        }
        for(int i=0;i<n;i++){
            if(c[a[i]-1]>1){c[a[i]-1]=0;metka[kz]=a[i];kz++;}
            if(d[a[i]-1]>1){a[i]=0;}
        }
        kz=n-1;
        SortShell(metka,n);
        for(int i=n-1;i>=0;i--){
            if(a[i]==0){
                while(metka[kz]==0){
                    kz--;
                }
                a[i]=metka[kz];kz--;
            }
        }
    }
    }

for(int i=0;i<n;i++){
    cout<<a[i]<<" ";
}
delete []metka;
delete []c;
delete []a;
delete []b;
return 0;
}


#include <iostream>
using namespace std;

int main(){

short n=0;
cin>>n;
short  *a=new short [n];
short  *b=new short [n];
short *c1=new short [n];

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

for(int i=0;i<n;i++){
    c1[a[i]-1]++;
    cin>>b[i];
}

for(int i=0;i<n;i++){
    if(c1[b[i]-1]==0 && c1[a[i]-1]>1){a[i]=b[i];c1[a[i]-1]--;}
}

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

}


#include <iostream>
using namespace std;

void SortShell(short *arr,short ns){
  int m=ns,p=0;
  while (m>0){
    m/=2;
    for (int j=0;j<ns;j++){
        if (j+m<ns){
                p=j;
                if (arr[p]>arr[p+m] ){
                swap (arr[p],arr[p+m]);
                while (p-m>=0){
                      if (arr[p] <arr[p-m] ){swap (arr[p],arr[p-m]);p-=m;}else break;
                  }
                }
        }else break;
    }
  }
}

int main(){

short n=0;
cin>>n;
short  *a=new short [n];
short  *b=new short [n];
short  *c=new short [n];
short  *metka=new short [n];
short  *d=new short [n];

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

for(int i=0;i<n;i++){
    c[a[i]-1]++;
    cin>>b[i];
}

for(int i=0;i<n;i++){
    if(c[b[i]-1]==0 && c[a[i]-1]>1){c[a[i]-1]--;a[i]=b[i];}
}
int lk=0;
for(int i=0;i<n;i++){
    d[a[i]-1]=c[a[i]-1];
    metka[i]=0;
    if(c[a[i]-1]>1)lk++;
}
if(lk>0){
        int z=0,zz=0,kz=0,kzz=0;
    for(int i=0;i<n-1;i++){
        if( a[i]<a[i+1] )z++; else zz++;
    }
    if(z>=zz){
       for(int i=1;i<=n;i++){
            if(c[i-1]==0){metka[kz]=i;kz++;lk--;}
            if (lk==0)break;
        }
        for(int i=0;i<n;i++){
            if(c[a[i]-1]>1){c[a[i]-1]=0;metka[kz]=a[i];kz++;}
            if(d[a[i]-1]>1){a[i]=0;}
        }
        kz=0;
        SortShell(metka,n);
        for(int i=0;i<n;i++){
            if(a[i]==0){
                while(metka[kz]==0){
                    kz++;
                }
                a[i]=metka[kz];kz++;
            }
        }
    }else{
        for(int i=n;i>=1;i--){
            if(c[i-1]==0){metka[kz]=i;kz++;lk--;}
             if(lk==0)break;
        }
        for(int i=0;i<n;i++){
            if(c[a[i]-1]>1){c[a[i]-1]=0;metka[kz]=a[i];kz++;}
            if(d[a[i]-1]>1){a[i]=0;}
        }
        kz=n-1;
        SortShell(metka,n);
        for(int i=0;i<n;i++){
            if(a[i]==0){
                while(metka[kz]==0){
                    kz--;
                }
                a[i]=metka[kz];kz--;
            }
        }
    }
    }

for(int i=0;i<n;i++){
    cout<<a[i]<<" ";
}
delete []metka;
delete []c;
delete []a;
delete []b;
return 0;
}


#include <iostream>
using namespace std;

void SortShell(short *arr,short *dd,short ns){
  int m=ns,p=0;
  while (m>0){
    m/=2;
    for (int j=0;j<ns;j++){
        if (j+m<ns){
                p=j;
                if (arr[p]>arr[p+m] && dd[p]>1 && dd[p+m]>1 ){
                swap (arr[p],arr[p+m]);
                while (p-m>=0){
                      if (arr[p] <arr[p-m] && dd[p]>1 && dd[p-m]>1 ){swap (arr[p],arr[p-m]);p-=m;}else break;
                  }
                }
        }else break;
    }
  }
}

int main(){

short n=0;
cin>>n;
short  *a=new short [n];
short  *b=new short [n];
short  *c=new short [n];
short  *metka=new short [n];
short  *d=new short [n];

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

for(int i=0;i<n;i++){
    c[a[i]-1]++;
    cin>>b[i];
}

for(int i=0;i<n;i++){
    if(c[b[i]-1]==0 && c[a[i]-1]>1){c[a[i]-1]--;a[i]=b[i];}
}
int lk=0;
for(int i=0;i<n;i++){
    d[i]=c[a[i]-1];
    if(c[a[i]-1]>1)lk++;
}
if(lk>0){
        lk=0;
    for(int i=1;i<=n;i++){
        if(c[i-1]==0){c[i-1]=i;metka[lk]=i;lk++;}
    }
lk=0;
    for(int i=0;i<n;i++){
        if(c[a[i]-1]>1){c[a[i]-1]--;a[i]=c[metka[lk]-1];lk++;}
    }
    bool f=false;
    for(int i=0;i<n-1;i++){
        if( a[i]<a[i+1]     ){f=true;break;}
    }
    if (f)SortShell(a,d,n);
}

for(int i=0;i<n;i++){
    cout<<a[i]<<" ";
}
delete []metka;
delete []c;
delete []a;
delete []b;
return 0;
}


#include <iostream>
using namespace std;

void SortShell(short *arr,short ns){
  int m=ns,p=0;
  while (m>0){
    m/=2;
    for (int j=0;j<ns;j++){
        if (j+m<ns){
                p=j;
                if (arr[p]>arr[p+m]){
                swap (arr[p],arr[p+m]);
                while (p-m>=0){
                      if (arr[p] <arr[p-m]){swap (arr[p],arr[p-m]);p-=m;}else break;
                  }
                }
        }else break;
    }
  }
}

int main(){

short n=0;
cin>>n;
short  *a=new short [n];
short  *b=new short [n];
short  *c=new short [n];
short *metka=new short [n];

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

for(int i=0;i<n;i++){
    c[a[i]-1]++;
    cin>>b[i];
}

for(int i=0;i<n;i++){
    if(c[b[i]-1]==0 && c[a[i]-1]>1){c[a[i]-1]--;a[i]=b[i];}
}
int lk=0;
for(int i=0;i<n;i++){
    if(c[a[i]-1]>1)lk++;
}
if(lk>0){
        lk=0;
    for(int i=1;i<=n;i++){
        if(c[i-1]==0){c[i-1]=i;metka[lk]=i;lk++;}
    }
lk=0;
    for(int i=0;i<n;i++){
        if(c[a[i]-1]>1){c[a[i]-1]--;a[i]=c[metka[lk]-1];lk++;}
    }
    SortShell(a,n);
}

for(int i=0;i<n;i++){
    cout<<a[i]<<" ";
}
delete []metka;
delete []c;
delete []a;
delete []b;
return 0;
}


#include <iostream>
using namespace std;

void SortShell(short *arr,short ns){
  int m=ns,p=0;
  while (m>0){
    m/=2;
    for (int j=0;j<ns;j++){
        if (j+m<ns){
                p=j;
                if (arr[p]>arr[p+m] ){
                swap (arr[p],arr[p+m]);
                while (p-m>=0){
                      if (arr[p] <arr[p-m] ){swap (arr[p],arr[p-m]);p-=m;}else break;
                  }
                }
        }else break;
    }
  }
}

int main(){

short n=0;
cin>>n;
short  *a=new short [n];
short  *b=new short [n];
short  *c=new short [n];
short  *metka=new short [n];
short  *d=new short [n];

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

for(int i=0;i<n;i++){
    c[a[i]-1]++;
    cin>>b[i];
}

for(int i=0;i<n;i++){
    if(c[b[i]-1]==0 && c[a[i]-1]>1){c[a[i]-1]--;a[i]=b[i];}
}
int lk=0;
for(int i=0;i<n;i++){
    d[i]=c[a[i]-1];
    metka[i]=0;
    if(c[a[i]-1]>1)lk++;
}
if(lk>0){
        int z=0,zz=0,kz=0,kzz=0;
    for(int i=0;i<n-1;i++){
        if( a[i]<a[i+1] )z++; else zz++;
    }
    if(z>=zz){
       for(int i=1;i<=n;i++){
            if(c[i-1]==0){metka[kz]=i;kz++;lk--;}
            if (lk==0)break;
        }
        for(int i=0;i<n;i++){
            if(c[a[i]-1]>1){c[a[i]-1]=0;metka[kz]=a[i];kz++;}
            if(d[a[i]-1]>1){a[i]=0;}
        }
        kz=0;
        SortShell(metka,n);
        for(int i=0;i<n;i++){
            if(a[i]==0){
                while(metka[kz]==0){
                    kz++;
                }
                a[i]=metka[kz];kz++;
            }
        }
    }else{
        for(int i=n;i>=1;i--){
            if(c[i-1]==0){metka[kz]=i;kz++;lk--;}
             if(lk==0)break;
        }
        for(int i=0;i<n;i++){
            if(c[a[i]-1]>1){c[a[i]-1]=0;metka[kz]=a[i];kz++;}
            if(d[a[i]-1]>1){a[i]=0;}
        }
        kz=n-1;
        SortShell(metka,n);
        for(int i=0;i<n;i++){
            if(a[i]==0){
                while(metka[kz]==0){
                    kz--;
                }
                a[i]=metka[kz];kz--;
            }
        }
    }
    }

for(int i=0;i<n;i++){
    cout<<a[i]<<" ";
}
delete []metka;
delete []c;
delete []a;
delete []b;
return 0;
}