#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define For(i,a,b,c) for(ll i=a;i<b;i+=c)
#define For2(i,a,b,c) for(ll i=a;i>=b;i-=c)
#define vec_ll vector<vector<ll>>
#define vec_pr vector<pair<ll,ll>>
#define pr pair<ll,ll>
#define pbk push_back
#define mkpr make_pair
#define fst first
#define snd second

bool s_sec(const pair<ll,ll> &a, const pair<ll,ll> &b) {
    return (a.snd < b.snd);
}

struct graph{
    vector<ll> nbr;
    ll len,depth,parent;
    bool visited[2];
    bool cycle;
    graph(){
        len=0;
        depth=0;
        parent=(-1);
        visited[0]=visited[1]=false;
        cycle=false;
    }
};

///This section will contain the typical functions that I regularly use
///Debugging Purpose
void print(ll *arr, ll n){
    For(i,0,n,1)cout<<arr[i]<<" ";
    cout<<"\n";
    return;
}

void print_vec(vector<ll> &arr, ll n){
    For(i,0,n,1)cout<<arr[i]<<" ";
    cout<<"\n";
    return;
}

void print_vec_pr(vec_pr &vec){
    ll len=vec.size();
    For(i,0,len,1){
        cout<<vec[i].first<<" "<<vec[i].second<<"\n";
    }
    return;
}

///Calculation Purpose
ll fast_inverse(ll a, ll p){
    //cout<<a<<" ";
    ll x=p-2;
    ll curr=a;
    ll ans=1;
    while(x!=0){
        if(x%2==1){
            ans=(ans*curr)%p;
        }
        x/=2;
        curr=(curr*curr)%p;
    }
    return ans;
}


///
/*ll bfs_mod(graph *node, ll u){

    queue<ll> bfs;
    ll cnt=1;

    bfs.push(u);
    node[u].visited[1]=true;

    while(!bfs.empty()){
        ll x=bfs.front();

        For(i,0,node[x].len,1){
            ll ft=node[x].nbr[i];

            if(!(node[ft].visited[1]||node[ft].cycle)){
                node[ft].visited[1]=true;
                cnt++;
                bfs.push(ft);
            }
        }

        bfs.pop();
    }
    //cout<<cnt<<"\n";
    return cnt;
}

void call_dfs(graph *node, vector<ll> &cyc, ll root, bool &signal){
    node[root].visited[0]=true;

    //cout<<"root:"<<root<<"\n";

    For(i,0,node[root].len,1){
        ll ft=node[root].nbr[i];
       // cout<<"ft: "<<ft<<"\n";

        if(ft!=node[root].parent){
            if(node[ft].visited[0]==true){
                if(node[ft].parent!=root&&signal==false){
                    cyc.pbk(ft);
                    cyc.pbk(root);
                    signal=true;
                    break;
                }
            }
            else{
                node[ft].parent=root;
                call_dfs(node,cyc,ft,signal);
                if(signal==true)return;
            }
        }
    }

    return;

}*/


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


    ll t;
    cin>>t;

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

        ll a[n];
        For(i,0,n,1)cin>>a[i];

        bool poss=false;

        ///

        ll x,y,z;
        vec_pr vec;
        For(i,0,n,1){
            vec.pbk(mkpr(a[i],i));
        }

        sort(vec.begin(),vec.end());
        //print_vec_pr(vec);

        ll min_m, l=(-1), r=(-1);

        For2(i,n-1,0,1){
            ll cnt=1,ptr=i-1;

            while(ptr>=0&&vec[ptr].fst==vec[ptr+1].fst){
                cnt++;
                ptr--;
            }

            sort(vec.begin()+ptr+1,vec.begin()+i+1,s_sec);
            if(cnt==1){
                if(l==(-1)){
                    l=vec[i].snd;
                    r=vec[i].snd;
                    min_m=vec[i].fst;
                }
                else{
                    ll temp[2]={l,r};
                    if(vec[i].snd<l)l=vec[i].snd;
                    if(vec[i].snd>r)r=vec[i].snd;

                    For2(j,temp[0]-1,l,1)min_m=min(min_m,a[j]);
                    For(j,temp[1]+1,r+1,1)min_m=min(min_m,a[j]);

                    ///Middle Segment and minimum updated
                    ///Calculated minimum in O(n)

                }
            }
            else
            if(cnt==2){
                /*cout<<l<<" "<<r<<"\n";
                cout<<"Element: "<<vec[i].fst<<"\n";*/
                if(l==(-1)){
                    r=vec[i].snd;
                    l=vec[i-1].snd;

                    min_m=vec[i].fst;
                    For(j,l+1,r,1){
                        min_m=min(min_m,a[j]);
                    }
                }
                else{
                    ll temp[2]={l,r};

                    if(l>vec[i-1].snd)l=vec[i-1].snd;
                    if(r<vec[i].snd)r=vec[i].snd;

                    For2(j,temp[0]-1,l,1)min_m=min(min_m,a[j]);
                    For(j,temp[1]+1,r+1,1)min_m=min(min_m,a[j]);

                    /*cout<<min_m<<"\n";
                    cout<<"Next: "<<l<<" "<<r<<"\n";*/

                    ///Middle Segment and minimum updated
                    ///Calculated minimum in O(n)
                }
            }
            else{
                if(l==(-1)){
                    poss=true;
                    x=vec[i-1].snd;
                    y=1;
                    z=n-1-vec[i-1].snd;
                    break;
                }
                else{
                    if(min_m<vec[i].fst||vec[ptr+1].snd>l||vec[i].snd<r){
                        ll temp[2]={l,r};
                        if(vec[ptr+1].snd<l)l=vec[ptr+1].snd;
                        if(vec[i].snd>r)r=vec[i].snd;

                        For2(j,temp[0]-1,l,1)min_m=min(min_m,a[j]);
                        For(j,temp[1]+1,r+1,1)min_m=min(min_m,a[j]);
                    }
                    else
                    if(min_m==vec[i].fst){
                        x=l;
                        y=r-l+1;
                        z=n-r-1;
                        poss=true;
                        break;
                    }
                    else{
                        ll indx[2];
                        For(j,ptr+1,i+1,1){
                            if(vec[j].snd>l){
                                indx[0]=j-1;
                                break;
                            }
                        }
                        For2(j,i,ptr+1,1){
                            if(vec[j].snd<r){
                                indx[1]=j+1;
                                break;
                            }
                        }

                        //cout<<indx[0]<<" "<<indx[1]<<"\n";

                        ll min_t=min_m;

                        if(indx[0]>ptr+1){
                            indx[0]=vec[indx[0]].snd;
                            For(j,indx[0],l,1){
                                min_t=min(a[j],min_t);
                            }

                            if(min_t==vec[i].fst){
                                x=indx[0];
                                y=r-indx[0]+1;
                                z=n-1-r;
                                poss=true;
                                break;
                            }
                        }

                        min_t=min_m;

                        if(indx[1]<i){
                            indx[1]=vec[indx[1]].snd;
                            For(j,r+1,indx[1]+1,1){
                                min_t=min(a[j],min_t);
                            }

                            if(min_t==vec[i].fst){
                                poss=true;
                                x=l;
                                y=indx[1]-l+1;
                                z=n-1-indx[1];
                                break;
                            }
                        }

                        ll temp[2]={l,r};

                        l=vec[ptr+1].snd;
                        r=vec[i].snd;

                        For2(j,temp[0]-1,l,1)min_m=min(min_m,a[j]);
                        For(j,temp[1]+1,r+1,1)min_m=min(min_m,a[j]);
                    }
                }
            }
            i=ptr+1;
        }

        ///

        if(poss==false){
            cout<<"NO\n";
        }
        else{
            cout<<"YES\n";
            cout<<x<<" "<<y<<" "<<z<<"\n";
        }
    }

}

### Prompt

Develop a solution in cpp to the problem described below:

You are given an array a consisting of n integers.

Let min(l, r) be the minimum value among a_l, a_{l + 1}, …, a_r and max(l, r) be the maximum value among a_l, a_{l + 1}, …, a_r.

Your task is to choose three positive (greater than 0) integers x, y and z such that:

  * x + y + z = n; 
  * max(1, x) = min(x + 1, x + y) = max(x + y + 1, n). 



In other words, you have to split the array a into three consecutive non-empty parts that cover the whole array and the maximum in the first part equals the minimum in the second part and equals the maximum in the third part (or determine it is impossible to find such a partition).

Among all such triples (partitions), you can choose any.

You have to answer t independent test cases.

Input

The first line of the input contains one integer t (1 ≤ t ≤ 2 ⋅ 10^4) — the number of test cases. Then t test cases follow.

The first line of the test case contains one integer n (3 ≤ n ≤ 2 ⋅ 10^5) — the length of a.

The second line of the test case contains n integers a_1, a_2, …, a_n (1 ≤ a_i ≤ 10^9), where a_i is the i-th element of a.

It is guaranteed that the sum of n does not exceed 2 ⋅ 10^5 (∑ n ≤ 2 ⋅ 10^5).

Output

For each test case, print the answer: NO in the only line if there is no such partition of a that satisfies the conditions from the problem statement. Otherwise, print YES in the first line and three integers x, y and z (x + y + z = n) in the second line.

If there are several answers, you can print any.

Example

Input


6
11
1 2 3 3 3 4 4 3 4 2 1
8
2 9 1 7 3 9 4 1
9
2 1 4 2 4 3 3 1 2
7
4 2 1 1 4 1 4
5
1 1 1 1 1
7
4 3 4 3 3 3 4


Output


YES
6 1 4
NO
YES
2 5 2
YES
4 1 2
YES
1 1 3
YES
2 1 4

### Response

```cpp
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define For(i,a,b,c) for(ll i=a;i<b;i+=c)
#define For2(i,a,b,c) for(ll i=a;i>=b;i-=c)
#define vec_ll vector<vector<ll>>
#define vec_pr vector<pair<ll,ll>>
#define pr pair<ll,ll>
#define pbk push_back
#define mkpr make_pair
#define fst first
#define snd second

bool s_sec(const pair<ll,ll> &a, const pair<ll,ll> &b) {
    return (a.snd < b.snd);
}

struct graph{
    vector<ll> nbr;
    ll len,depth,parent;
    bool visited[2];
    bool cycle;
    graph(){
        len=0;
        depth=0;
        parent=(-1);
        visited[0]=visited[1]=false;
        cycle=false;
    }
};

///This section will contain the typical functions that I regularly use
///Debugging Purpose
void print(ll *arr, ll n){
    For(i,0,n,1)cout<<arr[i]<<" ";
    cout<<"\n";
    return;
}

void print_vec(vector<ll> &arr, ll n){
    For(i,0,n,1)cout<<arr[i]<<" ";
    cout<<"\n";
    return;
}

void print_vec_pr(vec_pr &vec){
    ll len=vec.size();
    For(i,0,len,1){
        cout<<vec[i].first<<" "<<vec[i].second<<"\n";
    }
    return;
}

///Calculation Purpose
ll fast_inverse(ll a, ll p){
    //cout<<a<<" ";
    ll x=p-2;
    ll curr=a;
    ll ans=1;
    while(x!=0){
        if(x%2==1){
            ans=(ans*curr)%p;
        }
        x/=2;
        curr=(curr*curr)%p;
    }
    return ans;
}


///
/*ll bfs_mod(graph *node, ll u){

    queue<ll> bfs;
    ll cnt=1;

    bfs.push(u);
    node[u].visited[1]=true;

    while(!bfs.empty()){
        ll x=bfs.front();

        For(i,0,node[x].len,1){
            ll ft=node[x].nbr[i];

            if(!(node[ft].visited[1]||node[ft].cycle)){
                node[ft].visited[1]=true;
                cnt++;
                bfs.push(ft);
            }
        }

        bfs.pop();
    }
    //cout<<cnt<<"\n";
    return cnt;
}

void call_dfs(graph *node, vector<ll> &cyc, ll root, bool &signal){
    node[root].visited[0]=true;

    //cout<<"root:"<<root<<"\n";

    For(i,0,node[root].len,1){
        ll ft=node[root].nbr[i];
       // cout<<"ft: "<<ft<<"\n";

        if(ft!=node[root].parent){
            if(node[ft].visited[0]==true){
                if(node[ft].parent!=root&&signal==false){
                    cyc.pbk(ft);
                    cyc.pbk(root);
                    signal=true;
                    break;
                }
            }
            else{
                node[ft].parent=root;
                call_dfs(node,cyc,ft,signal);
                if(signal==true)return;
            }
        }
    }

    return;

}*/


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


    ll t;
    cin>>t;

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

        ll a[n];
        For(i,0,n,1)cin>>a[i];

        bool poss=false;

        ///

        ll x,y,z;
        vec_pr vec;
        For(i,0,n,1){
            vec.pbk(mkpr(a[i],i));
        }

        sort(vec.begin(),vec.end());
        //print_vec_pr(vec);

        ll min_m, l=(-1), r=(-1);

        For2(i,n-1,0,1){
            ll cnt=1,ptr=i-1;

            while(ptr>=0&&vec[ptr].fst==vec[ptr+1].fst){
                cnt++;
                ptr--;
            }

            sort(vec.begin()+ptr+1,vec.begin()+i+1,s_sec);
            if(cnt==1){
                if(l==(-1)){
                    l=vec[i].snd;
                    r=vec[i].snd;
                    min_m=vec[i].fst;
                }
                else{
                    ll temp[2]={l,r};
                    if(vec[i].snd<l)l=vec[i].snd;
                    if(vec[i].snd>r)r=vec[i].snd;

                    For2(j,temp[0]-1,l,1)min_m=min(min_m,a[j]);
                    For(j,temp[1]+1,r+1,1)min_m=min(min_m,a[j]);

                    ///Middle Segment and minimum updated
                    ///Calculated minimum in O(n)

                }
            }
            else
            if(cnt==2){
                /*cout<<l<<" "<<r<<"\n";
                cout<<"Element: "<<vec[i].fst<<"\n";*/
                if(l==(-1)){
                    r=vec[i].snd;
                    l=vec[i-1].snd;

                    min_m=vec[i].fst;
                    For(j,l+1,r,1){
                        min_m=min(min_m,a[j]);
                    }
                }
                else{
                    ll temp[2]={l,r};

                    if(l>vec[i-1].snd)l=vec[i-1].snd;
                    if(r<vec[i].snd)r=vec[i].snd;

                    For2(j,temp[0]-1,l,1)min_m=min(min_m,a[j]);
                    For(j,temp[1]+1,r+1,1)min_m=min(min_m,a[j]);

                    /*cout<<min_m<<"\n";
                    cout<<"Next: "<<l<<" "<<r<<"\n";*/

                    ///Middle Segment and minimum updated
                    ///Calculated minimum in O(n)
                }
            }
            else{
                if(l==(-1)){
                    poss=true;
                    x=vec[i-1].snd;
                    y=1;
                    z=n-1-vec[i-1].snd;
                    break;
                }
                else{
                    if(min_m<vec[i].fst||vec[ptr+1].snd>l||vec[i].snd<r){
                        ll temp[2]={l,r};
                        if(vec[ptr+1].snd<l)l=vec[ptr+1].snd;
                        if(vec[i].snd>r)r=vec[i].snd;

                        For2(j,temp[0]-1,l,1)min_m=min(min_m,a[j]);
                        For(j,temp[1]+1,r+1,1)min_m=min(min_m,a[j]);
                    }
                    else
                    if(min_m==vec[i].fst){
                        x=l;
                        y=r-l+1;
                        z=n-r-1;
                        poss=true;
                        break;
                    }
                    else{
                        ll indx[2];
                        For(j,ptr+1,i+1,1){
                            if(vec[j].snd>l){
                                indx[0]=j-1;
                                break;
                            }
                        }
                        For2(j,i,ptr+1,1){
                            if(vec[j].snd<r){
                                indx[1]=j+1;
                                break;
                            }
                        }

                        //cout<<indx[0]<<" "<<indx[1]<<"\n";

                        ll min_t=min_m;

                        if(indx[0]>ptr+1){
                            indx[0]=vec[indx[0]].snd;
                            For(j,indx[0],l,1){
                                min_t=min(a[j],min_t);
                            }

                            if(min_t==vec[i].fst){
                                x=indx[0];
                                y=r-indx[0]+1;
                                z=n-1-r;
                                poss=true;
                                break;
                            }
                        }

                        min_t=min_m;

                        if(indx[1]<i){
                            indx[1]=vec[indx[1]].snd;
                            For(j,r+1,indx[1]+1,1){
                                min_t=min(a[j],min_t);
                            }

                            if(min_t==vec[i].fst){
                                poss=true;
                                x=l;
                                y=indx[1]-l+1;
                                z=n-1-indx[1];
                                break;
                            }
                        }

                        ll temp[2]={l,r};

                        l=vec[ptr+1].snd;
                        r=vec[i].snd;

                        For2(j,temp[0]-1,l,1)min_m=min(min_m,a[j]);
                        For(j,temp[1]+1,r+1,1)min_m=min(min_m,a[j]);
                    }
                }
            }
            i=ptr+1;
        }

        ///

        if(poss==false){
            cout<<"NO\n";
        }
        else{
            cout<<"YES\n";
            cout<<x<<" "<<y<<" "<<z<<"\n";
        }
    }

}

```