#include<iostream>
#include <string>
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#define ll long long int
#define ld long double
#define pb push_back
#define endl "\n"
#define mp make_pair
#define sz(v) (int)(v.size())
#define len(s) (ll)(s.length())
#define M 1000000007
#define all(v) v.begin(),v.end()
#define fr(a,b,c) for(ll i=a;i<=b;i+=c)
#define inarr(arr,n); for(ll i=0;i<n;i++) cin >> arr[i];
#define outarr(arr,n); for(ll i=0;i<n;i++) cout<<arr[i]<<" ";
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
const ll inf = 9e18;
const ld pi = 2*acos(0.0); 
using namespace std;
ll power(ll a,ll n) 
{
    if(n==0){
        return 1;
    }
    ll p=power(a,n/2) % M;
    p = (p * p) % M;
    if (n%2==1)
    {
        p=(p*a)%M;
    }
    return p;
}
ll gcd(ll a, ll b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
}
const int N=1e6+5;
vector <ll> sieve(N,0); 
void si() 
{
    sieve[1]=1;
    for(int i=2;i<N;i++){
        if(sieve[i]==0){
            sieve[i]=1;
            for(int j=2*i;j<N;j+=i){
                sieve[j]=i;
            }
        }
    }
}
vector <ll> a(200055);
vector <ll> st(5*100000,0);
void build(ll n){//Input mein jo n ki  value that is parameter
        for(int i=0;i<n;i++){
            st[n+i]=a[i];
        }
        for(int i=n-1;i>=0;i--){
            st[i]=min(st[2*i],st[2*i+1]);
        }
}
void update(ll n,ll pos,ll val){ //pos is the index jispe update hai and val is the value
        st[n+pos]=val;
        pos+=n;
        while(pos>1){
            st[pos>>1]=min(st[pos],st[pos^1]);
            pos=pos>>1;
        }
}
ll query(ll n,ll l,ll r){ //l and r are range for query of the form [l,r) matlab r is not included
    l+=n;r+=n;
    ll ans=1e9+15;
    while(l<r){
        if(l&1){
            ans=min(ans,st[l++]);
        }                             //yahan jo bhi operation karna ho karlena
        if(r&1){
            ans=min(ans,st[--r]);
        }
        l=l>>1;
        r=r>>1;
    }
    return ans;
}
int main(){
    ios;
    int t;
    cin>>t;
    ll t1=t;
    while(t--){
       int n;
       cin>>n;
       inarr(a,n);
       build(n);
       map <ll,vector <ll> >m;
       for(int i=0;i<n;i++){
           m[a[i]].pb(i);
       }
       vector <ll> max1(n,0);
       max1[0]=a[0];
       for(int i=1;i<n;i++){
           max1[i]=max(max1[i-1],a[i]);
       }
       vector <ll> max2(n,0);
       max2[n-1]=a[n-1];
       for(int i=n-2;i>=0;i--){
           max2[i]=max(max2[i+1],a[i]);
       }
       ll L=-1,R=-1;
       for (auto itr:m){
           vector <ll> v=itr.second;
           ll val=itr.first;
           if(sz(v)>=3){
               for(int i=1;i<sz(v)-1;i++){
                   ll l=v[i]+1;
                   ll r=n-1;
                   ll x=-1,y=-1;
                   while(l<=r){
                       ll mid=(l+r)/2;
                       ll z=query(n,v[i],mid+1);
                       if(z!=val){
                           ll zz=query(n,v[i],mid);
                           if(zz==val){
                               if(a[mid-1]==val){
                                   if((mid-1)==v[i]){
                                       x=mid;
                                       break;
                                   }
                                   else{
                                       x=mid-1;
                                       break;
                                   }
                               }
                               x=mid;
                               break;
                           }
                           else{
                               r=mid-1;
                           }
                       }
                       else{
                           if(mid==n-1){
                               x=mid;
                               break;
                           }
                           if(a[mid]==val && max2[mid]==val){
                                x=mid;
                                break;
                            }
                           l=mid+1;
                       }
                   }
                   l=1;
                   r=v[i];
                   while(l<=r){
                       ll mid=(l+r)/2;
                       ll z=query(n,mid,v[i]+1);
                       if(z!=val){
                           l=mid+1;
                       }
                       else{
                           if(mid==0){
                               y=mid;
                               break;
                           }
                           if(max1[mid-1]==val){
                               y=mid;
                               break;
                           }
                           ll zz=query(n,mid-1,v[i]+1);
                           if(zz==val){
                               r=mid-1;
                           }
                           else{
                               y=mid;
                               break;
                           }
                       }
                   }
                   if(y!=-1 && y>=0 && y<n-1 && a[y]==val && y!=v[i] && max1[y]==val){
                       y+=1;
                   }
                   swap(x,y);
                   ll z=query(n,x,y);
                   if(x==0 || z!=val){
                       continue;
                   }
                   if(max1[x-1]==val && max2[y]==val && x!=-1 && y!=-1 && x>0 && x<n && y>0 && y<n){
                       L=x;
                       R=y;
                       break;
                   }
               }
           }
           if(L!=-1 && R!=-1){
               break;
           }
       }
       string z1="";
       for(int i=0;i<n;i++){
           string z2=to_string(a[i]);
           z1+=z2;
           z1+=',';
       }
       /*if(t1-t==132){
           cout<<z1<<endl;
           continue;
       }*/
       if(L==-1 && R==-1){
           cout<<"NO"<<endl;
           continue;
       }
        cout<<"YES"<<endl;
        cout<<L<<" "<<R-L<<" "<<n-R<<endl;
        for(int i=0;i<=n;i++){
            a[i]=0;
        }
        for(int i=0;i<=2*n+5;i++){
            st[i]=0;
        }
    }
    return 0;
}