#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cassert>

using namespace std;

struct MIN {
	int operator()(const int &_a, const int &_b) { return std::min(_a, _b); };
};

template<class T, class V, class REDUCE>
class FST {
public:
	FST(){};
	FST(vector<V> &_data) {build(_data);}
	void build(vector<V> &_data){
		data.resize(_data.size() * 4);
		size = _data.size();
		for(int i = 0; i < _data.size(); i++)update(i, _data[i]);
	}
	
	void update(size_t _i, T _v) {
		assert(_i < size);
		_update(_i, 0, size, _v, 1);
	}

	T _update(size_t _i, size_t _l, size_t _r, T _v,size_t _p) {
		assert(_p < data.size());
		
		//cerr << "_update(" << _i << ", " << _l << ", " << _r << ", " << _v << ", " << _p << ") -> ";
		if (_i == _l && _i + 1 == _r) {
			//cerr << "update value\n";
			data[_p] = _v; return _v;
		}
		
		size_t m = (_l + _r) / 2;
		if (m >= _i + 1) {
			//cerr<< "goto left(" << _l << ", " << m << ")\n";
			data[_p] = reduce(_update(_i, _l, m, _v, _p * 2), _query(m, _r , m, _r, _p * 2 + 1));
		}
		if (m <= _i) {
			//cerr<< "goto right(" << m << ", " << _r << ")\n";
			data[_p] = reduce(_update(_i, m, _r, _v, _p * 2 + 1), _query(_l, m , _l, m, _p * 2));
		}
		return data[_p];
	}
	
	T query(size_t _begin, size_t _end) {
		assert(_end <= size);
		return _query(_begin, _end, 0, size, 1);
	}
	
	T _query(size_t _begin, size_t _end, size_t _l, size_t _r, size_t _p) {
		//cerr << "_query(" << _begin << ", " << _end << ", " << _l << ", " << _r << ", " << _p << ") -> ";
		assert(_p < data.size());
		
		if (_begin <= _l && _r <= _end) {
			//cerr << "return value ("<<data[_p]<<")\n";
			return data[_p];
		}
		
		size_t m = (_l + _r) / 2;
		if (m >= _end) {
			//cerr<< "goto left(" << _l << ", " << m << ")\n";
			return _query(_begin, _end, _l, m, _p * 2);
		}
		if (m <= _begin) {
			//cerr<< "goto right(" << m << ", " << _r << ")\n";
			return _query(_begin, _end, m, _r, _p * 2 + 1);
		}
		//cerr << "reduce\n";
		return reduce(_query(_begin, _end, _l, m, _p * 2), _query(_begin, _end, m, _r, _p * 2 + 1));
	}
	vector<T> data;
private:
	REDUCE reduce;
	size_t size;
};

typedef FST<int, int, MIN> MINST;

int main(int argc, char **argv) {
	int n, t;
	cin >> t;
	
	while (t--) {
		cin >> n;
		vector<int> a(n);
		int m = 0;
		for(auto &_a: a) {
			cin >> _a;
			m = max(m, _a);
		}
		
		MINST st(a);
		
		int l = 1, r = n - 1, ml = a[0], mr = a[n - 1];
		
		while (l < r) {
			if (ml < mr) ml = max(ml, a[l++]);
			if (mr < ml) mr = max(mr, a[--r]);
			if (ml != mr || l >= r) continue;
			
			if (ml == m) {
				//cerr << "Check final interval (" << m << ")\n";
				for (; l < r; l++) {
					if (a[l] == ml) {
						cout << "YES" << endl << l << " 1 " << n - l - 1 << endl;
						break;
					}
				}
				break;
			}
			
			if (a[l] <= ml) {
				while (a[l] <= ml) l++;
				if (a[l - 1] == ml) l--;
			}
			
			if (a[r - 1] <= mr) {
				while (a[r - 1] <= mr) r--;
				if (a[r] == mr) r++;
			}
			
			//cerr << "check [" << l << ", " << r << ")\n";
			if (st.query(l, r) == ml) {
				cout << "YES" << endl << l << " " << r - l << " " << n - r << endl;
				break;
			}
			
			if (a[l] == ml) l++;
			if (a[r - 1] == mr) r--;
			
			ml = a[l++];
			mr = a[--r];
		}

		if (l >= r) cout << "NO" << endl;
	}
}
