#include <bits/stdc++.h>

using namespace std;

#define int long long
#define ff first
#define ss second
#define pb push_back
#define ld long double

const int N = 2e5 + 5, inf = 1e18 + 100;

int ok;

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

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

	if (*lf.rbegin() == *mid.begin() && *mid.begin() == *rg.rbegin())
    {
		ok = 1;
		cout << "YES" << '\n';
		cout << lf.size() << ' ' << mid.size() << ' ' << rg.size() << '\n';
	}
}

void solve()
{
    int n;
    cin >> n;
    vector < int > a(n);
    for (int i = 0; i < n; ++i)
        cin >> a[i];

    ok = 0;
    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]);
            r--;
        }

        if (l == r)
        {
            shift(rg, mid, a[r + 1]);
            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 (!ok) cout << "NO" << '\n';
}

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int q;
    cin >> q;
    while (q--)
        solve();
    return 0;
}
