#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";
        }
    }

}
