#include <bits/stdc++.h>
using namespace std;
#define FASTIO  ios_base::sync_with_stdio(0);cin.tie(0);

typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int,int> pii;
typedef vector<ll> vl;
typedef vector<vl> vll;

const ll mx = 1e9+7;
const ll inf = 1e18;


bool found;

void shift(multiset<int> &l, multiset<int> &r, int val){
    l.erase(l.find(val));
    r.insert(val);
}

void check(const multiset<int> &lf, const multiset<int> &mid, const multiset<int> &rg){
    if(found || lf.empty() || mid.empty() || rg.empty())return;

    if(*lf.rbegin() == *mid.begin() && *mid.begin() == *rg.rbegin()){
        found=true;
        cout<<"YES"<<endl;
        printf("%d %d %d\n",lf.size(),mid.size(),rg.size());
    }
}

void solve(){
    found=false;

    int n;
    cin>>n;

    vector<int> a(n);
    for(auto &it: a)cin>>it;

    multiset<int> lf,mid(a.begin(),a.end()),rg;
    int r=n-1;
    for(int l=0;l<n-2;++l){
        shift(mid,lf,a[l]);
        while(r-1>=l && a[r]<=*lf.rbegin()){
            shift(mid,rg,a[r--]);
        }
        while(r-1<l){
            shift(rg,mid,a[++r]);
        }

        check(lf,mid,rg);

        shift(lf,mid,a[l]);
        check(lf,mid,rg);
        shift(mid,lf,a[l]);

        if(rg.empty())continue;

        shift(rg,mid,a[r+1]);
        check(lf,mid,rg);
        shift(mid,rg,a[r+1]);
    }

    if(!found)cout<<"NO"<<endl;
    
}

int main() {
    // FASTIO

    // solve();

   int t;
   cin>>t;
   while(t--)solve();

    return 0;
}
