// Template begins
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <stdio.h>
#include <stack>
#include <math.h>
#include <complex>

using namespace std;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define endl "\n"
#define lb lower_bound
#define ub upper_bound
#define fo(i,a,b) for(i=a;i<=b;i++)
#define all(v) (v).begin(),(v).end()
#define sort0(v) sort(all(v))
#define lbb(a,b,arr,x) lower_bound(arr+a,arr+b+1,x)-arr
#define ubb(a,b,arr,x) upper_bound(arr+a,arr+b+1,x)-arr
#define freq(a,b,arr,x) upper_bound(arr+a,arr+b+1,x)-lower_bound(arr+a,arr+b+1,x)
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define d0(x) cout<<(x)<<" "
#define d1(x) cout<<(x)<<endl
#define d2(x,y) cout<<(x)<<" "<<(y)<<endl
#define d3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define d4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl
#define d5(a,b,c,d,e) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<" "<<(e)<<endl
#define d6(a,b,c,d,e,f) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<" "<<(e)<<" "<<(f)<<endl
#define max3(a,b,c) max(max((a),(b)),(c))
#define max4(a,b,c,d) max(max((a),(b)),max((c),(d)))
#define ss second
#define ff first
#define pb push_back
#define mp make_pair
#define printp(x) cout << x.ff << " " << x.ss << endl
template<class T> ostream& operator<<(ostream &os, vector<T> V) {
    for(auto v : V) os << v << " ";
    return cout << "";
}
template<class T> ostream& operator<<(ostream &os, set<T> S){
    for(auto s:S) os<<s<<" ";
    return cout << "";
}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {
    return os << P.first << " " << P.second;
}
const ll mod=1e9+7;
#define inf 9999999999999

ll inv(ll i){if(i==1) return 1;return (mod-((mod/i)*inv(mod%i))%mod)%mod;}

ll gcd(ll a,ll b){ if (b==0) return a;return gcd(b,a%b);}

ll pwr(ll a, ll b) {a %= mod; ll res = 1;while (b > 0) {if (b & 1) res = res * a % mod; a = a * a % mod; b >>= 1;}return res;}
//Template ends

ll a[200010], t[800010],T[800010];
int n;
void buildm(int v, int tl, int tr){
    if(tl>tr) return;
    if(tl==tr){
        t[v] = a[tl];
        return;
    }
    
    int tm = (tl+tr)/2;
    buildm(2*v,tl,tm);
    buildm(2*v+1,tm+1,tr);
    
    t[v] = min(t[2*v], t[2*v+1]);
}

void buildM(int v, int tl, int tr){
    if(tl>tr) return;
    if(tl==tr){
        T[v] = a[tl];
        return;
    }
    
    int tm = (tl+tr)/2;
    buildM(2*v,tl,tm);
    buildM(2*v+1,tm+1,tr);
    
    T[v] = max(T[2*v], T[2*v+1]);
}

ll minq(int v, int tl, int tr, int l, int r){
    if(l>tr or r<tl) return 1000000000;
    
    if(tl==l and tr==r){
        return t[v];
    }
    
    int tm = (tl+tr)/2;
    return min(minq(2*v,tl,tm,l,min(r,tm)),minq(2*v+1,tm+1,tr,max(tm+1,l),r));
}

ll minn(int l,int r){
    return minq(1,1,n,l,r);
}


ll maxq(int v, int tl, int tr, int l, int r){
    if(l>tr or r<tl) return 0;
    
    if(tl==l and tr==r){
        return T[v];
    }
    
    int tm = (tl+tr)/2;
    return max(maxq(2*v,tl,tm,l,min(r,tm)),maxq(2*v+1,tm+1,tr,max(tm+1,l),r));
}

ll maxx(int l,int r){
    return maxq(1,1,n,l,r);
}

int main(){
    fio;
    int t0,i;
    cin >> t0;
    while(t0--){
        cin >> n;
        for(i=1;i<=n;i++) cin >> a[i];
        buildm(1,1,n);
        buildM(1,1,n);
        
        ll curr = 0;

        bool z = false;
        
        for(i=1;i<=n;i++){
            curr = max(curr, a[i]);
            
            int l = i+1;
            int r = n-1;
            
            while(l<=r){
                int mid = (l+r)/2;
                ll val1 = minn(i+1,mid);
                ll val2 = maxx(mid+1,n);
                
                //d5(i,mid,val1,val2,curr);
                
                if(val1 == val2 and val1 == curr){
                    z = true;
                    d1("YES");
                    d3(i,mid-i,n-mid);
                    break;
                }
                
                if(val1 < curr or (val1 == curr and val2 < curr)){
                    r = mid - 1;
                }
                else{
                    l = mid + 1;
                }
            }
            
            if(z) break;
        }
        
        if(z){
            continue;
        }
        else{
            d1("NO");
        }
    }
}
