// https://codeforces.com/blog/entry/48994
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> v_int;
typedef unordered_map<int,int> umap_ii;

#define MAXN 200002
#define MAXK 20
int st[MAXN][MAXK];

void rmq_init(vector<int> &vals, int N, int K) {
	for (int i = 0; i < N; ++i) { st[i][0] = vals[i]; }

	for (int j = 1; j <= K; ++j)
		for (int i = 0; i + (1 << j) <= N; ++i)
			st[i][j] = min(st[i][j-1], st[i + (1 << (j - 1))][j - 1]);
}

int rmq_query(int L, int R, int log2[]) {
	int jj = log2[R-L+1];
	return min(st[L][jj], st[R - (1 << jj) + 1][jj]);
}
#define RMQ(_L, _R) rmq_query(_L, _R, log2)
#define RMQ_INIT() rmq_init(vals, N, log2[N])


int main() {
	int log2[MAXN+1] = { 0 }; // log[1] = 0;
	for (int i = 2; i <= MAXN; ++i) { log2[i] = log2[i>>1] + 1; }

	int T; cin >> T;
	for (int t=0; t < T; ++t) {
		int N; cin >> N;
		v_int vals(N);
		int maxv = 0;
		for (int n=0; n < N; ++n) { cin >> vals[n]; if (maxv < vals[n]){ maxv = vals[n];} }
		umap_ii counts;
		int second_pos;
		bool someValueAppears3times = false;
		for (int n=0; n < N; ++n) {
			++counts[vals[n]];
			someValueAppears3times = someValueAppears3times || (counts[vals[n]] > 2);
			if (vals[n] == maxv) { 
				if (counts[maxv] == 2) { second_pos = n; }
				else if (counts[maxv] > 2) { break; } // only need three, stop counting
			}
		}
		if (counts[maxv]>=3) { cout << "YES\n" << second_pos << ' ' << 1 << ' ' << N-second_pos-1 << "\n";
			continue;
		} else if (!someValueAppears3times) { cout << "NO\n"; continue; }
		
		vector<int> maxs_fwd(N), maxs_bck(N);
		maxs_fwd[0] = vals[0];
		for (int n=1; n < N; ++n) { maxs_fwd[n] = max(maxs_fwd[n-1], vals[n]); }
		//cout << "maxs_fwd:"; for (int v:maxs_fwd) { cout << ' ' << v; } cout << endl;
		maxs_bck[N-1] = vals[N-1];
		for (int n=N-2; n >= 0; --n) { maxs_bck[n] = max(maxs_bck[n+1], vals[n]); }
		
		RMQ_INIT();
		int ans_x=-1, ans_y=-1;
		
		for (int x=0; x < N-2; ++x) {
			int h = maxs_fwd[x];
			int lo = x+2, hi = N-1;
			//cout << h << ' ' << lo << ' ' << hi << endl;
			while (lo < hi) {
				int mid = (lo + hi) / 2;
				int qq1 = RMQ(x+1, mid-1);
				int qq2 = maxs_bck[mid];
				//cout << '\t' << mid << "; " << qq1 << ' ' << qq2 << endl;
				bool go_up = (qq1 > h) || (qq2 > h);
				bool go_down = (qq1 < h) || (qq2 < h);
				if (go_up == go_down) { break; } // cannot do both, let's quit
				if (go_up) { lo = mid+1; }
				if (go_down) { hi = mid - 1; }
			}
			int y = (lo+hi)/2;
			if (lo <= hi and h == maxs_bck[y] and h == RMQ(x+1, y-1)) { ans_x = x; ans_y = y; break; }
		}
		if (ans_x != -1) {
			printf("YES\n%d %d %d\n", ans_x+1, ans_y -ans_x - 1, N - ans_y);
		} else { cout << "NO\n"; }
	}
}

### Prompt

Please create a solution in Cpp to the following problem:

You are given an array a consisting of n integers.

Let min(l, r) be the minimum value among a_l, a_{l + 1}, …, a_r and max(l, r) be the maximum value among a_l, a_{l + 1}, …, a_r.

Your task is to choose three positive (greater than 0) integers x, y and z such that:

  * x + y + z = n; 
  * max(1, x) = min(x + 1, x + y) = max(x + y + 1, n). 



In other words, you have to split the array a into three consecutive non-empty parts that cover the whole array and the maximum in the first part equals the minimum in the second part and equals the maximum in the third part (or determine it is impossible to find such a partition).

Among all such triples (partitions), you can choose any.

You have to answer t independent test cases.

Input

The first line of the input contains one integer t (1 ≤ t ≤ 2 ⋅ 10^4) — the number of test cases. Then t test cases follow.

The first line of the test case contains one integer n (3 ≤ n ≤ 2 ⋅ 10^5) — the length of a.

The second line of the test case contains n integers a_1, a_2, …, a_n (1 ≤ a_i ≤ 10^9), where a_i is the i-th element of a.

It is guaranteed that the sum of n does not exceed 2 ⋅ 10^5 (∑ n ≤ 2 ⋅ 10^5).

Output

For each test case, print the answer: NO in the only line if there is no such partition of a that satisfies the conditions from the problem statement. Otherwise, print YES in the first line and three integers x, y and z (x + y + z = n) in the second line.

If there are several answers, you can print any.

Example

Input


6
11
1 2 3 3 3 4 4 3 4 2 1
8
2 9 1 7 3 9 4 1
9
2 1 4 2 4 3 3 1 2
7
4 2 1 1 4 1 4
5
1 1 1 1 1
7
4 3 4 3 3 3 4


Output


YES
6 1 4
NO
YES
2 5 2
YES
4 1 2
YES
1 1 3
YES
2 1 4

### Response

```cpp
// https://codeforces.com/blog/entry/48994
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> v_int;
typedef unordered_map<int,int> umap_ii;

#define MAXN 200002
#define MAXK 20
int st[MAXN][MAXK];

void rmq_init(vector<int> &vals, int N, int K) {
	for (int i = 0; i < N; ++i) { st[i][0] = vals[i]; }

	for (int j = 1; j <= K; ++j)
		for (int i = 0; i + (1 << j) <= N; ++i)
			st[i][j] = min(st[i][j-1], st[i + (1 << (j - 1))][j - 1]);
}

int rmq_query(int L, int R, int log2[]) {
	int jj = log2[R-L+1];
	return min(st[L][jj], st[R - (1 << jj) + 1][jj]);
}
#define RMQ(_L, _R) rmq_query(_L, _R, log2)
#define RMQ_INIT() rmq_init(vals, N, log2[N])


int main() {
	int log2[MAXN+1] = { 0 }; // log[1] = 0;
	for (int i = 2; i <= MAXN; ++i) { log2[i] = log2[i>>1] + 1; }

	int T; cin >> T;
	for (int t=0; t < T; ++t) {
		int N; cin >> N;
		v_int vals(N);
		int maxv = 0;
		for (int n=0; n < N; ++n) { cin >> vals[n]; if (maxv < vals[n]){ maxv = vals[n];} }
		umap_ii counts;
		int second_pos;
		bool someValueAppears3times = false;
		for (int n=0; n < N; ++n) {
			++counts[vals[n]];
			someValueAppears3times = someValueAppears3times || (counts[vals[n]] > 2);
			if (vals[n] == maxv) { 
				if (counts[maxv] == 2) { second_pos = n; }
				else if (counts[maxv] > 2) { break; } // only need three, stop counting
			}
		}
		if (counts[maxv]>=3) { cout << "YES\n" << second_pos << ' ' << 1 << ' ' << N-second_pos-1 << "\n";
			continue;
		} else if (!someValueAppears3times) { cout << "NO\n"; continue; }
		
		vector<int> maxs_fwd(N), maxs_bck(N);
		maxs_fwd[0] = vals[0];
		for (int n=1; n < N; ++n) { maxs_fwd[n] = max(maxs_fwd[n-1], vals[n]); }
		//cout << "maxs_fwd:"; for (int v:maxs_fwd) { cout << ' ' << v; } cout << endl;
		maxs_bck[N-1] = vals[N-1];
		for (int n=N-2; n >= 0; --n) { maxs_bck[n] = max(maxs_bck[n+1], vals[n]); }
		
		RMQ_INIT();
		int ans_x=-1, ans_y=-1;
		
		for (int x=0; x < N-2; ++x) {
			int h = maxs_fwd[x];
			int lo = x+2, hi = N-1;
			//cout << h << ' ' << lo << ' ' << hi << endl;
			while (lo < hi) {
				int mid = (lo + hi) / 2;
				int qq1 = RMQ(x+1, mid-1);
				int qq2 = maxs_bck[mid];
				//cout << '\t' << mid << "; " << qq1 << ' ' << qq2 << endl;
				bool go_up = (qq1 > h) || (qq2 > h);
				bool go_down = (qq1 < h) || (qq2 < h);
				if (go_up == go_down) { break; } // cannot do both, let's quit
				if (go_up) { lo = mid+1; }
				if (go_down) { hi = mid - 1; }
			}
			int y = (lo+hi)/2;
			if (lo <= hi and h == maxs_bck[y] and h == RMQ(x+1, y-1)) { ans_x = x; ans_y = y; break; }
		}
		if (ans_x != -1) {
			printf("YES\n%d %d %d\n", ans_x+1, ans_y -ans_x - 1, N - ans_y);
		} else { cout << "NO\n"; }
	}
}

```