#include<bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define fu(i,a,b) for(ll i=a;i<=b;i++)
#define fd(i,a,b) for(ll i=a;i>=b;i--)
using namespace std;
const ll N = (ll)2e5+5;
const ll inf = (ll)1e17;
ll a[N] , n , t , pre[N] , lead[N] , l[N] , r[N];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> t;
    while(t--)
    {
        cin >> n;
        fu(i,1,n)
            cin >> a[i];
        lead[n+1] = 0;
        fd(i,n,1)
            lead[i] = max(lead[i+1] , a[i]);
        fu(i,1,n)
            pre[i] = max(pre[i-1] , a[i]);
        deque<ll> q;
        q.push_back(0);
        a[0] = -inf;
        a[n+1] = -inf;
        fu(i,1,n)
        {
            while((int)q.size() != 0 && a[i] <= a[q.back()])
                q.pop_back();
//            cout<<"S";
            l[i] = q.back() + 1;
            q.push_back(i);
        }
//        cout<<"S";
        q.clear();
        q.push_back(n+1);
        fd(i,n,1)
        {
            while((int)q.size() != 0 && a[i] <= a[q.back()])
                q.pop_back();
            r[i] = q.back() - 1;
            q.push_back(i);
        }
        ll res1 = -1 , res2 = -1 , res3 = -1;
        fu(i,1,n)
        {
            bool kt1 = 0 , kt2 = 0;
            ll x , y , z;
            if(l[i] < i)
            {
                if(pre[l[i]] == a[i])
                {
                    x = l[i];
                    kt1 = 1;
                }
            }
            if(pre[l[i] - 1] == a[i])
            {
                x = l[i] - 1;
                kt1 = 1;
            }
            if(r[i] > i)
            {
                if(lead[r[i]] == a[i])
                {
                    y = r[i];
                    kt2 = 1;
                }
            }
            if(lead[r[i] + 1] == a[i])
            {
                y = r[i] + 1;
                kt2 = 1;
            }
//            cout<<i<<" "<<l[i]<<" "<<r[i]<<" "<<kt1<<" "<<kt2<<" "<<pre[l[i]-1]<<" "<<lead[r[i]+1]<<"\n";
            if(kt1 & kt2 == 1)
            {
                res1 = x;
                res2 = y - x - 1;
                res3 = n - y + 1;
                break;
            }
        }
        if(res1 == -1)
        {
            cout<<"NO"<<"\n";
            continue;
        }
        cout<<"YES"<<"\n";
        cout<<res1<<" "<<res2<<" "<<res3<<"\n";
    }
}
