链接:https://codeforces.com/contest/1265/problem/C

So the Beautiful Regional Contest (BeRC) has come to an end! nn students took part in the contest. The final standings are already known: the participant in the ii-th place solved pipi problems. Since the participants are primarily sorted by the number of solved problems, then p1≥p2≥⋯≥pnp1≥p2≥⋯≥pn.

Help the jury distribute the gold, silver and bronze medals. Let their numbers be gg, ss and bb, respectively. Here is a list of requirements from the rules, which all must be satisfied:

  • for each of the three types of medals, at least one medal must be awarded (that is, g>0g>0, s>0s>0 and b>0b>0);
  • the number of gold medals must be strictly less than the number of silver and the number of bronze (that is, g<sg<s and g<bg<b, but there are no requirements between ss and bb);
  • each gold medalist must solve strictly more problems than any awarded with a silver medal;
  • each silver medalist must solve strictly more problems than any awarded a bronze medal;
  • each bronze medalist must solve strictly more problems than any participant not awarded a medal;
  • the total number of medalists g+s+bg+s+b should not exceed half of all participants (for example, if n=21n=21, then you can award a maximum of 1010 participants, and if n=26n=26, then you can award a maximum of 1313 participants).

The jury wants to reward with medals the total maximal number participants (i.e. to maximize g+s+bg+s+b) so that all of the items listed above are fulfilled. Help the jury find such a way to award medals.

Input

The first line of the input contains an integer tt (1≤t≤100001≤t≤10000) — the number of test cases in the input. Then tt test cases follow.

The first line of a test case contains an integer nn (1≤n≤4⋅1051≤n≤4⋅105) — the number of BeRC participants. The second line of a test case contains integers p1,p2,…,pnp1,p2,…,pn (0≤pi≤1060≤pi≤106), where pipi is equal to the number of problems solved by the ii-th participant from the final standings. The values pipi are sorted in non-increasing order, i.e. p1≥p2≥⋯≥pnp1≥p2≥⋯≥pn.

The sum of nn over all test cases in the input does not exceed 4⋅1054⋅105.

Output

Print tt lines, the jj-th line should contain the answer to the jj-th test case.

The answer consists of three non-negative integers g,s,bg,s,b.

  • Print g=s=b=0g=s=b=0 if there is no way to reward participants with medals so that all requirements from the statement are satisfied at the same time.
  • Otherwise, print three positive numbers g,s,bg,s,b — the possible number of gold, silver and bronze medals, respectively. The sum of g+s+bg+s+b should be the maximum possible. If there are several answers, print any of them.

Example

input

Copy

5
12
5 4 4 3 2 2 1 1 1 1 1 1
4
4 3 2 1
1
1000000
20
20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
32
64 64 63 58 58 58 58 58 37 37 37 37 34 34 28 28 28 28 28 28 24 24 19 17 17 17 17 16 16 16 16 11

output

Copy

1 2 3
0 0 0
0 0 0
2 5 3
2 6 6

Note

In the first test case, it is possible to reward 11 gold, 22 silver and 33 bronze medals. In this case, the participant solved 55 tasks will be rewarded with the gold medal, participants solved 44 tasks will be rewarded with silver medals, participants solved 22&nbs***bsp;33 tasks will be rewarded with bronze medals. Participants solved exactly 11 task won't be rewarded. It's easy to see, that in this case, all conditions are satisfied and it is possible to reward participants in this way. It is impossible to give more than 66 medals because the number of medals should not exceed half of the number of participants. The answer 11, 33, 22 is also correct in this test case.

In the second and third test cases, it is impossible to reward medals, because at least one medal of each type should be given, but the number of medals should not exceed half of the number of participants.

代码:

#include <bits/stdc++.h>
using namespace std;
long long n,t,x;
struct node {
	long long s;
	long long b;
}a[1000001];
bool cmp(node p,node q)
{
	return p.b<q.b;
}
map<long long ,long long>m;
int main()
{
	cin>>t;
	while(t--)
	{
		cin>>n;
		m.clear();
		int k=0;
		for(int i=1;i<=n;i++)
		{
			cin>>x;
			if(m[x]==0)
			{
				k++;
				a[k].b=x;
			}
			m[x]++;
		}
		for(int i=1;i<=k;i++)
		{
			a[i].s=m[a[i].b];
		}
		sort(a+1,a+1+k,cmp);
		long long sum=0,j=1;
		while(sum*2<n&&j<=k)
		{
			sum+=a[j].s;
			j++;
		}
		long long s1=0,s2=0,s3=0;
		long long g=n-sum;
		long long p=k-1;
		s1=a[k].s;
		while(s2<=s1)
		{
			s2+=a[p].s;
			p--;
		}
		s3=g-s1-s2;
		if(s1<=0||s2<=0||s3<=0||(s3<=s1))
		cout<<0<<" "<<0<<" "<<0<<endl;
		else
		cout<<s1<<" "<<s2<<" "<<s3<<endl;
	}
}