#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

using namespace std;

#define vvi             vector<vector<int>>
#define ld              long double
#define mod             1000000007
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vpii            vector<pair<int,int>>
#define all(x)          x.begin(),x.end()
#define sz(a)           (int)(a.size())
#define vi              vector<int>
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define SS              stringstream
#define db(...)         __f(#__VA_ARGS__, __VA_ARGS__)

template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << '\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}

// const int dirx[4] = {0, 0, -1, 1};
// const int diry[4] = { -1, 1, 0, 0};

// 0 -> l, 1 - > r, 2 -> u , 3 -> down

void FASTIO()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

const int mxN = 2e6 + 100;
int n, m, k, q, ans;
int a[mxN];
int treeMax[mxN];
int treeMin[mxN];
string s;

void updateMax(int node, int start, int end, int idx, int val)
{
    if(start == end)
    {
        // Leaf node
        a[idx] = val;
        treeMax[node] = val;
    }
    else
    {
        int mid = (start + end) / 2;
        if(start <= idx and idx <= mid)
        {
            // If idx is in the left child, recurse on the left child
            updateMax(2*node, start, mid, idx, val);
        }
        else
        {
            // if idx is in the right child, recurse on the right child
            updateMax(2*node+1, mid+1, end, idx, val);
        }
        // Internal node will have the sum of both of its children
        treeMax[node] = max(treeMax[2*node], treeMax[2*node+1]);
    }
}

int queryMax(int node, int start, int end, int l, int r)
{
    if(r < start or end < l)
    {
        // range represented by a node is completely outside the given range
        return -1e18;
    }
    if(l <= start and end <= r)
    {
        // range represented by a node is completely inside the given range
        return treeMax[node];
    }
    // range represented by a node is partially inside and partially outside the given range
    int mid = (start + end) / 2;
    int p1 = queryMax(2*node, start, mid, l, r);
    int p2 = queryMax(2*node+1, mid+1, end, l, r);
    return max(p1, p2);
}

void updateMin(int node, int start, int end, int idx, int val)
{
    if(start == end)
    {
        // Leaf node
        a[idx] = val;
        treeMin[node] = val;
    }
    else
    {
        int mid = (start + end) / 2;
        if(start <= idx and idx <= mid)
        {
            // If idx is in the left child, recurse on the left child
            updateMin(2*node, start, mid, idx, val);
        }
        else
        {
            // if idx is in the right child, recurse on the right child
            updateMin(2*node+1, mid+1, end, idx, val);
        }
        // Internal node will have the sum of both of its children
        treeMin[node] = min(treeMin[2*node], treeMin[2*node+1]);
    }
}

int queryMin(int node, int start, int end, int l, int r)
{
    if(r < start or end < l)
    {
        // range represented by a node is completely outside the given range
        return 1e18;
    }
    if(l <= start and end <= r)
    {
        // range represented by a node is completely inside the given range
        return treeMin[node];
    }
    // range represented by a node is partially inside and partially outside the given range
    int mid = (start + end) / 2;
    int p1 = queryMin(2*node, start, mid, l, r);
    int p2 = queryMin(2*node+1, mid+1, end, l, r);
    return min(p1, p2);
}

int findmin(int s, int e)
{
	if(s == e)
		return a[s];
	return queryMin(1,1,n,s,e);
}

int findmax(int s, int e)
{
	if(s == e)
		return a[s];
	return queryMax(1,s,e,1,n);
}

void test_case()
{
	cin >> n;

	for(int i = 1; i <= n; i++)
	{
		cin >> a[i];
		treeMin[i] = treeMax[i] = 0;
	}

	for(int i = 1; i <= n; i++)
	{
		updateMin(1,1,n,i,a[i]);
	}

	map<int, vi> index;

	int mx = 0;

	for(int i = n; i >= 2; i--)
	{
		mx = max(mx, a[i]);
		index[mx].pb(i - 1);
	}

	mx = 0;

	for(int i = 1; i <= n - 2; i++)
	{
		mx = max(mx, a[i]);
		if(index.find(mx) == index.end())
			continue;

		int s = max(i + 1, index[mx].back());
		int e = index[mx][0];

		while(s <= e)
		{
			int mid = (s + e) >> 1;
			if(findmin(i + 1, mid) == mx)
			{
				// db(mid, mx);
				cout << "YES\n" << i << " " << mid - (i + 1) + 1 << " " << n - (mid + 1) + 1 << '\n';
				return;
			}
			else if(findmin(i + 1, mid) > mx)
			{
				s = mid + 1;
			}
			else
			{
				e = mid - 1;
			}
		}
	}

	cout << "NO\n";
	return;
}

int32_t main()
{
	FASTIO();

	int t;
	t = 1;
	cin >> t;

	for (int i = 1; i <= t; i++)
	{
		// cout << "Case #" << i << ": ";
		test_case();
	}
	return 0;
}