#include <bits/stdc++.h>

using namespace std;
using ll = long long;

const int N = 1e6 + 5;

int a[N], st[N][19], lg[N], mx[N][19];

int main() {
	ios :: sync_with_stdio(0), cin.tie(0);
	int t;
	cin >> t;
	while (t--) {
		int n;
		cin >> n;
		map <int, int> mnpos, mxpos;
		for (int i = 1; i <= n; ++i) {
			cin >> a[i];
			mxpos[a[i]] = i;
			if (!mnpos[a[i]])
				mnpos[a[i]] = i;
			st[i][0] = a[i];
			mx[i][0] = a[i];
		}
		for (int i = 2; i <= n; ++i) 
			lg[i] = lg[i / 2] + 1;
		for (int i = 1; i <= 18; ++i) {
			for (int j = 1; j + (1 << (i - 1)) <= n; ++j) 
				st[j][i] = min(st[j][i - 1], st[j + (1 << (i - 1))][i - 1]); 
		}
		for (int i = 1; i <= 18; ++i) {
			for (int j = 1; j + (1 << (i - 1)) <= n; ++j) 
				mx[j][i] = max(mx[j][i - 1], mx[j + (1 << (i - 1))][i - 1]); 
		}
		auto Get = [&] (int l, int r) {
			int len = r - l + 1;
			int x = lg[len];
			return min(st[l][x], st[r - (1 << x) + 1][x]);
		};
		auto Get_max = [&] (int l, int r) {
			int len = r - l + 1;
			int x = lg[len];
			return max(mx[l][x], mx[r - (1 << x) + 1][x]);
		};
		int x = 0, y, z;
		for (int i = 1; i <= n; ++i) {
			int j = mxpos[a[i]];
			int L = i + 1, R = j, mda = 0;
			while (R >= L) {
				int M = (L + R) / 2;
				if (Get_max(M, n) == a[i]) {
					mda = M;
					R = M - 1;
				}
				else
					L = M + 1;
			}
			j = mda;
			int k = mnpos[a[i]];
			L = k, R = i - 1, mda = 0;
			while (R >= L) {
				int M = (L + R) / 2;
				if (Get_max(1, M) == a[i]) {
					mda = M;
					L = M + 1;
				}
				else
					R = M - 1;
			}
			k = mda;
			if (j && k && j > k && Get(k + 1, j - 1) == a[i]) {
				x = k;
				z = n - j + 1;
				y = n - x - z;
			}
		}
		if (x) 
			cout << "YES\n" << x << ' ' << y << ' ' << z << '\n';
		else
			cout << "NO\n";
	}
	return 0;
}