So the Beautiful Regional Contest (BeRC) has come to an end! $n$ students took part in the contest. The final standings are already known: the participant in the $i$-th place solved $p_i$ problems. Since the participants are primarily sorted by the number of solved problems, then $p_1 \ge p_2 \ge \dots \ge p_n$.

Help the jury distribute the gold, silver and bronze medals. Let their numbers be $g$, $s$ and $b$, 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>0$, $s>0$ and $b>0$);  the number of gold medals must be strictly less than the number of silver and the number of bronze (that is, $g<s$ and $g<b$, but there are no requirements between $s$ and $b$);  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+b$ should not exceed half of all participants (for example, if $n=21$, then you can award a maximum of $10$ participants, and if $n=26$, then you can award a maximum of $13$ participants). 

The jury wants to reward with medals the total maximal number participants (i.e. to maximize $g+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 $t$ ($1 \le t \le 10000$) — the number of test cases in the input. Then $t$ test cases follow.

The first line of a test case contains an integer $n$ ($1 \le n \le 4\cdot10^5$) — the number of BeRC participants. The second line of a test case contains integers $p_1, p_2, \dots, p_n$ ($0 \le p_i \le 10^6$), where $p_i$ is equal to the number of problems solved by the $i$-th participant from the final standings. The values $p_i$ are sorted in non-increasing order, i.e. $p_1 \ge p_2 \ge \dots \ge p_n$.

The sum of $n$ over all test cases in the input does not exceed $4\cdot10^5$.


-----Output-----

Print $t$ lines, the $j$-th line should contain the answer to the $j$-th test case.

The answer consists of three non-negative integers $g, s, b$.  Print $g=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, b$ — the possible number of gold, silver and bronze medals, respectively. The sum of $g+s+b$ should be the maximum possible. If there are several answers, print any of them. 


-----Example-----
Input
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
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 $1$ gold, $2$ silver and $3$ bronze medals. In this case, the participant solved $5$ tasks will be rewarded with the gold medal, participants solved $4$ tasks will be rewarded with silver medals, participants solved $2$ or $3$ tasks will be rewarded with bronze medals. Participants solved exactly $1$ 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 $6$ medals because the number of medals should not exceed half of the number of participants. The answer $1$, $3$, $2$ 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.

Source: codeforces | Difficulty: MEDIUM
Tags: Implementation

Greedy algorithms


Solutions:
3
import os
import sys

def main():
	T = read_int()
	for _ in range(T):
		N = read_int()
		P = read_ints()
		print(*solve(N, P))

def solve(N, P):
	C = []
	i = 0
	while i < N:
		j = i + 1
		while j < N and P[j] == P[i]:
			j += 1
		C.append(j - i)
		i = j
	if N < 10 or len(C) < 3:
		return (0, 0, 0)
	half = N // 2
	g = C[0]
	s = 0
	i = 1
	while i < len(C) and g >= s:
		s += C[i]
		i += 1
	b = 0
	while i < len(C) and g >= b:
		b += C[i]
		i += 1
	if s == 0 or b == 0 or g >= s or (g >= b) or (g + s + b > half):
		return (0, 0, 0)
	while i < len(C):
		if g + s + b + C[i] > half:
			break
		b += C[i]
		i += 1
	return (g, s, b)
DEBUG = 'DEBUG' in os.environ

def inp():
	return sys.stdin.readline().rstrip()

def read_int():
	return int(inp())

def read_ints():
	return [int(e) for e in inp().split()]

def dprint(*value, sep=' ', end='\n'):
	if DEBUG:
		print(*value, sep=sep, end=end)

def __starting_point():
	main()
__starting_point()


for _ in range(int(input())):
	a = int(input())
	li = list(map(int, input().split()))
	d = {}
	e = []
	for i in li:
		try:
			d[i] += 1
		except KeyError:
			d[i] = 1
			e.append(i)
	m = a // 2
	k = 0
	su = 0
	for i in e:
		if su + d[i] <= m:
			k += 1
			su += d[i]
		else:
			break
	if k < 3:
		print(0, 0, 0)
	else:
		g = d[e[0]]
		h = 0
		ind = 1
		while h <= g and ind < k:
			h += d[e[ind]]
			ind += 1
		u = 0
		for i in range(ind, k):
			u += d[e[i]]
		if g < h and g < u:
			print(g, h, u)
		else:
			print(0, 0, 0)


import math
from collections import deque

def Work():
	n = int(input())
	a = list(map(int, input().split()))
	pr = []
	x = 0
	m = {}
	for i in range(n):
		if a[i] in m:
			m[a[i]] += 1
		else:
			m[a[i]] = 1
	sorted(m, reverse=True)
	for (k, v) in m.items():
		if x + v <= int(n / 2):
			pr.append(v)
			x += v
		else:
			break
	if len(pr) > 2:
		(g, b, s) = (pr[0], 0, 0)
		idx = len(pr) - 1
		x -= pr[0]
		s = x
		while (s <= g or b <= g) and idx > 0:
			s -= pr[idx]
			b += pr[idx]
			idx -= 1
		if g < s and g < b and (s > 0) and (b > 0) and (g > 0):
			print(g, s, b, end=' ')
		else:
			print('0 0 0')
	else:
		print('0 0 0')
t = int(input())
for _ in range(t):
	Work()


from sys import stdin
a = lambda : stdin.readline().split()
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	lst = [*map(int, a())]
	if n < 5:
		print(0, 0, 0)
		continue
	(g, s, b, item) = (0, 0, 0, n // 2)
	for i in range(n // 2 - 1, -1, -1):
		if lst[i] == lst[i + 1]:
			item -= 1
		else:
			break
	(cout, level) = (1, 1)
	for (i, x) in enumerate(lst[1:item]):
		if x == lst[i]:
			cout += 1
		elif level == 1:
			g += cout
			(cout, level) = (1, 2)
		elif level == 2:
			s += cout
			cout = 1
			if s > g:
				level = 3
		else:
			b += cout
			cout = 1
	if level == 3:
		b += cout
		if s > g and b > g:
			if g != 0 and s != 0 and (b != 0):
				print(g, s, b)
			else:
				print(0, 0, 0)
		else:
			print(0, 0, 0)
	else:
		print(0, 0, 0)


T = int(input(''))
for _ in range(T):
	n = int(input(''))
	p = list(map(int, input('').split(' ')))
	d = {}
	k = []
	t = 0
	for i in range(n):
		if p[i] not in d:
			k.append(p[i])
			d[p[i]] = 0
		d[p[i]] = d[p[i]] + 1
	l = len(k)
	s = 0
	b = 0
	if l < 3:
		print('0 0 0')
		continue
	g = d[k[0]]
	ind = -1
	for i in range(1, l, 1):
		if s <= g:
			s = s + d[k[i]]
		else:
			ind = i
			break
	if ind == -1:
		print('0 0 0')
		continue
	for i in range(ind, l, 1):
		if s + b + g + d[k[i]] > n // 2:
			break
		else:
			b = b + d[k[i]]
	if b <= g:
		print('0 0 0')
	else:
		print(str(g) + ' ' + str(s) + ' ' + str(b))


for _ in range(int(input())):
	ln = int(input())
	a = [int(x) for x in input().split()]
	my_g = my_s = my_b = -1
	g = s = b = 0
	for i in range(ln):
		if my_g == -1:
			my_g = a[i]
		if a[i] == my_g:
			g += 1
		elif a[i] < my_g:
			if my_s == -1:
				my_s = a[i]
			if a[i] == my_s or s <= g:
				if a[i] <= my_s:
					my_s = a[i]
				s += 1
			elif a[i] < my_s:
				if my_b == -1:
					my_b = a[i]
				if a[i] <= my_b or b <= g:
					if a[i] <= my_b:
						my_b = a[i]
					b += 1
					if i == ln // 2 - 1:
						if a[i + 1] != a[i]:
							break
						else:
							b -= a[0:ln // 2].count(a[i])
							break
	if g >= s or g >= b or g + s + b > ln // 2:
		print(0, 0, 0)
	else:
		print(g, s, b)


tc = int(input())
for i in range(tc):
	n = int(input())
	p = list(map(int, input().split()))
	tracker = [1]
	for k in range(1, n):
		if p[k] == p[k - 1]:
			tracker[-1] += 1
		else:
			tracker.append(1)
	half = n // 2
	(g, s, b) = (0, 0, 0)
	possible = []
	total = 0
	for k in tracker:
		if total + k <= half:
			possible.append(k)
			total += k
		else:
			break
	if len(possible) < 3:
		print('0 0 0')
	else:
		g = possible[0]
		sumpos = sum(possible[1:])
		total = 0
		found = False
		for k in possible[1:]:
			if total + k > possible[0] and sumpos - (total + k) > possible[0]:
				print(possible[0], total + k, sumpos - (total + k))
				found = True
				break
			total += k
		if not found:
			print('0 0 0')


import sys
import collections
import heapq
import math
input = sys.stdin.readline

def rints():
	return map(int, input().strip().split())

def rstr():
	return input().strip()

def rint():
	return int(input().strip())

def rintas():
	return [int(i) for i in input().strip().split()]

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
t = rint()
for _ in range(t):
	n = rint()
	p = rintas()
	ans = [0, 0, 0]
	d = n // 2
	cmp = p[d]
	while d > 0 and p[d - 1] == cmp:
		d -= 1
	if d >= 5:
		(g, s, b) = (0, 0, 0)
		idx = 0
		for i in range(d):
			idx = i
			if i == 0 or p[i] == p[i - 1]:
				g += 1
			else:
				break
		for i in range(idx, d):
			idx = i
			if i == 0 or p[i] == p[i - 1] or s <= g:
				s += 1
			else:
				break
		b = d - idx
		if g > 0 and s > 0 and (b > 0) and (g < s) and (g < b):
			print(str(g) + ' ' + str(s) + ' ' + str(b))
		else:
			print('0 0 0')
	else:
		print('0 0 0')


import sys
input = sys.stdin.readline
from collections import Counter
t = int(input())
for testcases in range(t):
	n = int(input())
	P = list(map(int, input().split()))
	C = Counter(P)
	PLIST = sorted(set(P), reverse=True)
	g = C[PLIST[0]]
	s = 0
	b = 0
	sflag = 1
	for i in PLIST[1:]:
		if sflag:
			if s <= g:
				s += C[i]
			else:
				sflag = 0
				bflag = 1
				b += C[i]
		elif bflag:
			if b <= g:
				b += C[i]
			elif g + s + b + C[i] <= n // 2:
				b += C[i]
			else:
				break
	if g + s + b <= n // 2:
		print(g, s, b)
	else:
		print(0, 0, 0)


from collections import Counter
t = int(input())
for i in range(t):
	n = int(input())
	pros = [-1] + list(map(int, input().split()))
	if n < 3:
		print(0, 0, 0)
		continue
	mid = n // 2
	cur = mid
	while cur >= 1:
		if pros[cur] == pros[mid + 1]:
			cur -= 1
		else:
			break
	if cur < 3:
		print(0, 0, 0)
		continue
	counter = Counter(pros[1:cur + 1])
	keys = sorted(list(counter.keys()), reverse=True)
	if len(keys) < 3:
		print(0, 0, 0)
		continue
	gold = counter[keys[0]]
	del keys[0]
	silver = 0
	bronze = 0
	while silver <= gold and len(keys) > 0:
		silver += counter[keys[0]]
		del keys[0]
	for key in keys:
		bronze += counter[key]
	if silver > gold and bronze > gold and (gold > 0):
		print(gold, silver, bronze)
	else:
		print(0, 0, 0)


import sys
inf = float('inf')

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
T = int(input())
while T:
	n = int(input())
	Arr = get_array()
	last_index = dict()
	for i in range(n):
		last_index[Arr[i]] = i
	if n < 6:
		print(0, 0, 0)
		T -= 1
		continue
	cut = n // 2
	Arr = Arr[:cut]
	mydict = dict()
	for i in Arr:
		mydict[i] = mydict.get(i, 0) + 1
	gold = mydict[Arr[0]]
	rest = cut - gold
	if 2 * (gold + 1) > rest:
		print(0, 0, 0)
		T -= 1
		continue
	silver = 0
	bronze = 0
	i = gold
	while i < cut:
		if last_index[Arr[i]] < cut:
			silver += mydict[Arr[i]]
		i += mydict[Arr[i]]
		if silver > gold:
			break
	while i < cut:
		if last_index[Arr[i]] < cut:
			bronze += mydict[Arr[i]]
		i += mydict[Arr[i]]
	if silver > 0 and bronze > 0 and (silver > gold) and (bronze > gold):
		print(gold, silver, bronze)
	else:
		print(0, 0, 0)
	T -= 1


def beautiful_contest(results, length):
	medalists = ''
	middle_point = length // 2
	end_point = middle_point
	for i in range(middle_point - 1, -1, -1):
		if results[middle_point] == results[i]:
			end_point = i
		else:
			break
	gold = silver = bronze = 0
	for i in range(end_point):
		gold += 1
		if results[i + 1] != results[i]:
			break
	for i in range(gold, end_point):
		silver += 1
		if results[i + 1] != results[i] and silver > gold:
			break
	for i in range(gold + silver, end_point):
		bronze += 1
	if gold < 0 or silver < 0 or bronze < 0:
		medalists = '0 0 0'
	elif gold >= silver or gold >= bronze:
		medalists = '0 0 0'
	else:
		medalists = str(gold) + ' ' + str(silver) + ' ' + str(bronze)
	return medalists

def main():
	num_of_tests = eval(input())
	for i in range(num_of_tests):
		length = eval(input())
		test = input()
		print(beautiful_contest(test.split(), length))
main()


from math import *
from collections import *
import sys
sys.setrecursionlimit(10 ** 9)
t = int(input())
for y in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	g = s = b = 0
	i = 0
	while i < n - 1 and a[i + 1] == a[i]:
		i += 1
	i += 1
	g = i
	while i < n - 1 and a[i + 1] == a[i]:
		i += 1
		s += 1
	i += 1
	s += 1
	while i <= n // 2:
		j = 0
		while i < n - 1 and a[i + 1] == a[i]:
			i += 1
			j += 1
		i += 1
		if i <= n // 2:
			if s <= g:
				s += j + 1
			else:
				b += j + 1
		else:
			break
	if g + b + s <= n // 2 and g * b * s > 0 and (g < b) and (g < s):
		print(g, s, b)
	else:
		print(0, 0, 0)


import sys
import math, bisect
sys.setrecursionlimit(10 ** 5)
from itertools import groupby, accumulate
from heapq import heapify, heappop, heappush
from collections import deque, Counter, defaultdict
I = lambda : int(sys.stdin.readline())
neo = lambda : map(int, sys.stdin.readline().split())
Neo = lambda : list(map(int, sys.stdin.readline().split()))
for _ in range(I()):
	n = I()
	p = Neo()
	g = 1
	while g < n and p[g - 1] == p[g]:
		g += 1
	s = g + 1
	while g + s < n and p[g + s - 1] == p[g + s]:
		s += 1
	a = n // 2
	while a > 0 and p[a - 1] == p[a]:
		a -= 1
	b = a - g - s
	if b > g:
		print(g, s, b)
	else:
		print(0, 0, 0)


from collections import Counter
for nt in range(int(input())):
	n = int(input())
	p = list(map(int, input().split()))
	if n < 8:
		print(0, 0, 0)
	else:
		if p[n // 2] == p[n // 2 - 1]:
			num = p[n // 2]
			l = []
			for i in p:
				if i != num:
					l.append(i)
				else:
					break
		else:
			l = p[0:n // 2]
		if len(l) == 0:
			print(0, 0, 0)
			continue
		c = []
		count = 1
		for i in range(1, len(l)):
			if l[i] == l[i - 1]:
				count += 1
			else:
				c.append([l[i - 1], count])
				count = 1
		c.append([l[-1], count])
		if len(c) < 3:
			print(0, 0, 0)
		else:
			g = c[0][1]
			(s, b) = (0, 0)
			for i in range(1, len(c)):
				if s <= g:
					s += c[i][1]
				else:
					b += c[i][1]
			if g < s and g < b:
				print(g, s, b)
			else:
				print(0, 0, 0)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	if n < 10:
		print(0, 0, 0)
	else:
		l = l[:n // 2 + 1]
		i = 1
		elem = l[-1]
		if elem == l[-2]:
			for x in range(len(l) - 3, -1, -1):
				if l[x] != elem:
					break
			l = l[:x + 1]
		else:
			l = l[:n // 2]
		if len(l) < 5:
			print(0, 0, 0)
		elif len(set(l)) < 3:
			print(0, 0, 0)
		else:
			g = 1
			b = 0
			for x in range(len(l) - 1):
				if l[x] == l[x + 1]:
					g += 1
				else:
					gb = 0
					break
			s = g + 1
			for i in range(x + s, len(l) - 1):
				if l[i] == l[i + 1]:
					s += 1
				else:
					break
			b = len(l) - (g + s)
			if g >= s or g >= b:
				print(0, 0, 0)
			else:
				print(g, s, b)


from collections import defaultdict
t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(j) for j in input().split()]
	d = defaultdict(int)
	for x in arr:
		d[x] += 1
	num = []
	for x in d:
		num += [[x, d[x]]]
	num.sort(reverse=True)
	pfx1 = []
	su = 0
	for i in range(len(num)):
		su += num[i][1]
		if su > n // 2:
			break
		pfx1 += [num[i][:]]
	if len(pfx1) < 3:
		print(0, 0, 0)
		continue
	su1 = pfx1[0][1]
	su2 = 0
	su3 = 0
	fflag = 0
	for i in range(1, len(pfx1)):
		su2 += pfx1[i][1]
		if su2 > su1:
			ind = i + 1
			fflag = 1
			break
	if fflag == 1:
		for i in range(ind, len(pfx1)):
			su3 += pfx1[i][1]
	if su3 <= su1 or su2 <= su1:
		print(0, 0, 0)
	else:
		print(su1, su2, su3)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def RLL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def N():
	return int(input())

def comb(n, m):
	return factorial(n) / (factorial(m) * factorial(n - m)) if n >= m else 0

def perm(n, m):
	return factorial(n) // factorial(n - m) if n >= m else 0

def mdis(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)

def toord(c):
	return ord(c) - ord('a')

def lcm(a, b):
	return a * b // lcm(a, b)
mod = 998244353
INF = float('inf')
from math import factorial, sqrt, ceil, floor, gcd
from collections import Counter, defaultdict, deque
from heapq import heapify, heappop, heappush

def main():
	for _ in range(N()):
		n = N()
		arr = RLL()
		narr = []
		for i in arr:
			if narr and i == narr[-1][0]:
				narr[-1][1] += 1
			else:
				narr.append([i, 1])
		now = n
		while narr and now > n // 2:
			now -= narr.pop()[1]
		g = s = b = 0
		if len(narr) >= 3:
			g = narr[0][1]
			al = sum((i[1] for i in narr))
			for i in range(1, len(narr)):
				s += narr[i][1]
				b = al - s - g
				if g < s and g < b:
					print(g, s, b)
					break
			else:
				print(0, 0, 0)
		else:
			print(0, 0, 0)
main()


a = int(input())
for i in range(a):
	r = int(input())
	z = list(map(int, input().split()))
	flag = 0
	ans = [0]
	ans[0] = 1
	if len(z) < 10:
		print(0, 0, 0)
		continue
	count = 0
	g = 1
	s = 0
	b = 0
	gold = 0
	change = 0
	for i in range(1, len(z) // 2):
		if z[i] == z[i - 1] and g == 1:
			ans.append(1)
		elif z[i] == z[i - 1] and s == 1:
			ans.append(2)
		elif z[i] == z[i - 1] and b == 1:
			ans.append(3)
		else:
			change = i
			count += 1
			if count == 1:
				gold = i
				ans.append(2)
				g = 0
				s = 1
			elif i - gold > gold:
				g = 0
				s = 0
				b = 1
				ans.append(3)
			else:
				ans.append(2)
	if z[len(z) // 2] == z[change]:
		ans = ans[0:change]
	if ans.count(1) < ans.count(2) and ans.count(1) < ans.count(3):
		print(ans.count(1), ans.count(2), ans.count(3))
	else:
		print(0, 0, 0)


import math
for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	d = {}
	for i in a:
		d[i] = d.get(i, 0) + 1
	b = list(d.keys())
	b.sort(reverse=True)
	low = 0
	high = len(b)
	l = len(b)
	while low < high:
		mid = math.ceil((low + high) / 2)
		i = 0
		ans0 = 0
		while i < mid:
			ans0 += d[b[i]]
			i += 1
		ans1 = 0
		while i < l:
			ans1 += d[b[i]]
			i += 1
			if ans1 > ans0:
				break
		ans2 = 0
		while i < l:
			ans2 += d[b[i]]
			i += 1
			if ans2 > ans0:
				break
		if ans0 + ans1 + ans2 <= n // 2:
			low = mid
		else:
			high = mid - 1
	if low == 0:
		print(0, 0, 0)
	else:
		mid = low
		i = 0
		ans0 = 0
		while i < mid:
			ans0 += d[b[i]]
			i += 1
		ans1 = 0
		while i < l:
			ans1 += d[b[i]]
			i += 1
			if ans1 > ans0:
				break
		ans2 = 0
		while i < l:
			ans2 += d[b[i]]
			i += 1
			if ans2 > ans0:
				break
		while i < l:
			if ans2 + ans0 + ans1 + d[b[i]] <= n // 2:
				ans2 += d[b[i]]
				i += 1
			else:
				break
		print(ans0, ans1, ans2)


import sys

def input():
	return sys.stdin.readline()
for j in range(int(input())):
	n = int(input())
	c = list(map(int, input().split()))
	maximum = n // 2
	s = [[c[0], 0]]
	for i in c:
		if s[-1][0] == i:
			s[-1][1] += 1
		else:
			s.append([i, 1])
	(gold, silv, bron) = (0, 0, 0)
	if len(s) <= 3:
		print(0, 0, 0)
		continue
	gold = s[0][1]
	silv = s[1][1]
	i = 2
	n = len(s)
	while gold >= silv and i != n:
		silv += s[i][1]
		i += 1
	summa = gold + silv
	while i != n and s[i][1] + summa <= maximum:
		summa += s[i][1]
		bron += s[i][1]
		i += 1
	if summa > maximum or gold * silv * bron == 0 or gold >= silv or (bron <= gold):
		print(0, 0, 0)
	else:
		print(gold, silv, bron)


q = int(input())
for _ in range(q):
	n = int(input())
	d = {}
	arr = list(map(int, input().split()))
	for i in arr:
		d[i] = d.get(i, 0) + 1
	arr = sorted(list(d.keys()), reverse=True)
	g = d[arr[0]]
	s = 0
	b = 0
	i = 1
	while i < len(arr):
		if s > g:
			break
		s += d[arr[i]]
		i += 1
	while i < len(arr):
		if b + d[arr[i]] + s + g <= n // 2:
			b += d[arr[i]]
			i += 1
		else:
			break
	if g < s and g < b:
		print(g, s, b)
	else:
		print(0, 0, 0)


import sys
import os
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
mod = 10 ** 9 + 7

def lcm(x, y):
	return x * y / gcd(x, y)

def fact(x, mod=mod):
	ans = 1
	for i in range(1, x + 1):
		ans = ans * i % mod
	return ans

def arr2D(n, m, default=0):
	return [[default for j in range(m)] for i in range(n)]

def arr3D(n, m, r, default=0):
	return [[[default for k in range(r)] for j in range(m)] for i in range(n)]

def sortDictV(x):
	return {k: v for (k, v) in sorted(x.items(), key=lambda item: item[1])}

class DSU:

	def __init__(self, length):
		self.length = length
		self.parent = [-1] * self.length

	def getParent(self, node, start):
		if node >= self.length:
			return False
		if self.parent[node] < 0:
			if start != node:
				self.parent[start] = node
			return node
		return self.getParent(self.parent[node], start)

	def union(self, node1, node2):
		parent1 = self.getParent(node1, node1)
		parent2 = self.getParent(node2, node2)
		if parent1 == parent2:
			return False
		elif self.parent[parent1] <= self.parent[parent2]:
			self.parent[parent1] += self.parent[parent2]
			self.parent[parent2] = parent1
		else:
			self.parent[parent2] += self.parent[parent1]
			self.parent[parent1] = parent2
		return True

	def getCount(self, node):
		return -self.parent[self.getParent(node, node)]

def exact(num):
	if abs(num - round(num)) <= 10 ** (-9):
		return round(num)
	return num

def solve(n, lst):
	if n < 3:
		print(0, 0, 0)
		return
	out = lst[n // 2]
	half = []
	for i in lst:
		if i <= out:
			break
		half.append(i)
	if len(half) < 3:
		print(0, 0, 0)
		return
	maxxCount = half.count(half[0])
	numCount = []
	prev = -1
	for i in half[maxxCount:]:
		if i != prev:
			numCount.append(1)
			prev = i
		else:
			numCount[-1] += 1
	currSum = 0
	tot = len(half)
	get = False
	for i in numCount:
		currSum += i
		if currSum > maxxCount and tot - currSum - maxxCount > maxxCount:
			get = True
			break
	if get:
		(g, s, b) = (maxxCount, currSum, tot - currSum - maxxCount)
		print(g, s, b)
	else:
		print(0, 0, 0)
for _ in range(int(input())):
	n = int(input())
	lst = list(map(int, input().split()))
	solve(n, lst)


import sys, math, itertools, heapq, collections, bisect, string, copy
input = lambda : sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10 ** 8)
inf = float('inf')
mod = 10 ** 9 + 7
ans = 0
count = 0
pro = 1
n = int(input())

def ranlen(s):
	ans = []
	count = 1
	n = len(s)
	i = 1
	while i < n:
		if s[i] == s[i - 1]:
			count += 1
		else:
			ans.append(count)
			count = 1
		i += 1
	ans.append(count)
	return ans

def solve():
	n = int(input())
	n2 = math.ceil(n / 2)
	P = list(input().split())
	ra = ranlen(P)
	ra.reverse()
	m = len(ra)
	for i in range(m):
		if n2 <= 0:
			break
		else:
			n2 -= ra[i]
			n -= ra[i]
	ra = ra[i:]
	ra.reverse()
	s0 = ra[0]
	count = 0
	m = len(ra)
	for i in range(1, m):
		count += ra[i]
		if count > s0 and n - s0 - count > s0:
			print(s0, count, n - s0 - count)
			return
	print(0, 0, 0)
for i in range(n):
	solve()


import bisect
from itertools import accumulate
from collections import Counter, defaultdict
import sys
sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline

def solve():
	N = int(input())
	L = list(map(int, input().split()))
	C = Counter(L)
	L = sorted(list(set(L)), reverse=True)
	L_acc = [0]
	for l in L:
		L_acc.append(C[l])
	L_acc = list(accumulate(L_acc))
	ind = bisect.bisect_right(L_acc, N // 2)
	for g_ind in range(1, ind):
		for s_ind in range(g_ind + 1, ind):
			g = L_acc[g_ind]
			s = L_acc[s_ind] - L_acc[g_ind]
			b = L_acc[ind - 1] - g - s
			if g < s and g < b:
				return [g, s, b]
	return []
T = int(input())
for _ in range(T):
	ret = solve()
	if len(ret) == 0:
		print('0 0 0')
	else:
		print(' '.join(map(str, ret)))


t = int(input())
while t:
	n = int(input())
	A = [int(i) for i in input().split()]
	R = []
	i = 0
	while i < len(A):
		tmp = A[i]
		cnt = 0
		while i < len(A) and A[i] == tmp:
			i += 1
			cnt += 1
		R.append(cnt)
	amount = int(n / 2)
	(g, s, b) = (R[0], 0, 0)
	i = 1
	while i < len(R) and s <= g:
		s += R[i]
		i += 1
	while i < len(R) and s + g + b + R[i] <= amount:
		b += R[i]
		i += 1
	if s <= g or b <= g or s == 0 or (b == 0):
		print(0, 0, 0)
	else:
		print(g, s, b)
	t -= 1


for _ in range(int(input())):
	_ = input()
	tmp = input()
	n = map(int, tmp.split())
	n = list(n)
	a = [1]
	for (i, x) in enumerate(n[1:]):
		i += 1
		if x == n[i - 1]:
			a[-1] += 1
		else:
			a.append(1)
	p = 0
	for x in a[1:]:
		if p + x + a[0] > len(n) // 2:
			break
		p += x
		if p > a[0]:
			break
	if p <= a[0]:
		print('0 0 0')
		continue
	half = 0
	for x in a:
		if half + x > len(n) // 2:
			break
		half += x
	q = half - a[0] - p
	if q <= a[0]:
		print('0 0 0')
	else:
		print('{} {} {}'.format(a[0], p, q))


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	i = n // 2
	while 0 < i < n and a[i - 1] == a[i]:
		i -= 1
	if i < 5:
		print(0, 0, 0)
	else:
		g = 0
		s = 1
		while g < s < i:
			g += 1
			while g < i and a[g - 1] == a[g]:
				g += 1
			s = max(s, g * 2 + 1)
			while s < i and a[s - 1] == a[s]:
				s += 1
			if g < s - g and g < i - s:
				print(g, s - g, i - s)
				break
		else:
			print(0, 0, 0)


q = int(input())
for i in range(q):
	n = int(input())
	p = list(map(int, input().split(' ')))
	if n < 10:
		print('0 0 0')
		continue
	mx = n // 2
	g = 1
	while g < mx and p[g] == p[0]:
		g = g + 1
	if g * 3 + 2 > mx:
		print('0 0 0')
		continue
	s = 2 * g + 1
	while s < mx and p[s] == p[2 * g]:
		s = s + 1
	b = mx - 1
	if p[b] == p[mx]:
		tmp = p[b]
		while b > 0 and p[b] == tmp:
			b = b - 1
	if b - s + 1 <= g:
		print('0 0 0')
		continue
	out = str(g) + ' ' + str(s - g) + ' ' + str(b - s + 1)
	print(out)


for case in range(int(input())):
	n = int(input())
	problem_solved_dict = {}
	problems_solved_sequence = [int(x) for x in input().split()]
	for x in problems_solved_sequence:
		try:
			problem_solved_dict[x] += 1
		except KeyError:
			problem_solved_dict[x] = 1
	medals = []
	can_be_awarded = 0
	diffrent_score = 0
	awardable_score_frequency = []
	if n <= 5:
		print('0 0 0')
		continue
	else:
		for key in problem_solved_dict.keys():
			temp = can_be_awarded + problem_solved_dict[key]
			if temp > n // 2:
				break
			else:
				diffrent_score += 1
				can_be_awarded += problem_solved_dict[key]
				awardable_score_frequency.append(problem_solved_dict[key])
	if diffrent_score < 3:
		print('0 0 0')
		continue
	gold = awardable_score_frequency[0]
	silver = 0
	for x in awardable_score_frequency[1:diffrent_score]:
		silver += x
		if silver > gold:
			break
	bronze = sum(awardable_score_frequency) - silver - gold
	if bronze == 0 or gold >= bronze:
		print('0 0 0')
	else:
		print('{} {} {}'.format(gold, silver, bronze))


from sys import stdin
from collections import Counter

def iinput():
	return int(stdin.readline())

def sinput():
	return input()

def minput():
	return map(int, stdin.readline().split())

def linput():
	return list(map(int, stdin.readline().split()))
t = iinput()
while t:
	t -= 1
	n = iinput()
	p = linput()
	if n < 5:
		print(0, 0, 0)
	else:
		medal = [0, 0, 0]
		c = Counter(p)
		l = list(c.values())
		medal[0] = l[0]
		j = 1
		while j < len(l) and medal[1] <= medal[0]:
			medal[1] += l[j]
			j += 1
		if sum(medal) < n // 2:
			while j < len(l) and (medal[2] <= medal[0] or sum(medal) + l[j] <= n // 2):
				medal[2] += l[j]
				j += 1
		if sum(medal) > n // 2 or 0 in medal:
			medal = [0, 0, 0]
		print(*medal)


t = int(input())
for i in range(t):
	n = int(input())
	dop = list(map(int, input().split()))
	mas = []
	mas.append([dop[0], 1])
	for j in range(1, n):
		if mas[-1][0] == dop[j]:
			mas[-1][1] += 1
		else:
			mas.append([dop[j], 1])
	g = mas[0][1]
	m = len(mas)
	k = n // 2
	kol = g
	s = 0
	b = 0
	for j in range(1, m):
		kol += mas[j][1]
		if kol > k:
			break
		if s <= g:
			s += mas[j][1]
		else:
			b += mas[j][1]
	if g != 0 and s != 0 and (b != 0) and (g < s) and (g < b) and (g + b + s <= k):
		print(g, s, b)
	else:
		print(0, 0, 0)


t = int(input())
for x in range(t):
	n = int(input())
	ar = list(map(int, input().split()))
	mx = ar[0]
	ind = 0
	sp = []
	sp.append([])
	sp[-1].append(mx)
	sp[-1].append(1)
	for i in range(1, n):
		if ar[i] == sp[-1][0]:
			sp[-1][1] += 1
		else:
			sp.append([])
			sp[-1].append(ar[i])
			sp[-1].append(1)
	g = sp[0][1]
	mxk = n // 2
	mxk -= g
	fl = False
	if mxk <= 0:
		fl = True
	lst = 1
	s = 0
	for i in range(1, len(sp)):
		if s <= g:
			s += sp[i][1]
			mxk -= sp[i][1]
			lst = i
		if mxk <= 0:
			fl = True
			break
	lst += 1
	if lst != len(sp):
		b = 0
		ne = 0
		for i in range(lst, len(sp)):
			if b <= g:
				b += sp[i][1]
				mxk -= sp[i][1]
				ne = i
			if mxk < 0:
				fl = True
				break
		if mxk > 0:
			ne += 1
			while mxk > 0:
				if ne < len(sp) and mxk - sp[ne][1] >= 0:
					mxk -= sp[ne][1]
					b += sp[ne][1]
					ne += 1
				else:
					mxk = 0
					break
	else:
		fl = True
	if mxk < 0:
		fl = True
	if fl:
		print(0, 0, 0)
	else:
		print(g, s, b)


n = int(input())
for i in range(n):
	length = int(input()) // 2 + 1
	li = [int(x) for x in input().split(' ')][0:length]
	currentNum = li[-1]
	for e in range(len(li) - 2, -1, -1):
		if li[e] != currentNum:
			li = li[0:e + 1]
			length = len(li)
			break
	currentNum = li[0]
	currentCount = 1
	l = []
	for e in range(1, length):
		if li[e] == currentNum:
			currentCount += 1
		else:
			l.append(currentCount)
			currentCount = 1
			currentNum = li[e]
	l.append(currentCount)
	gsb = [0, 0, 0]
	gsb[0] = l[0]
	for i in range(1, len(l)):
		gsb[1] += l[i]
		if gsb[1] > gsb[0]:
			gsb[2] = sum(l[i + 1:])
			break
	if gsb[0] < gsb[1] and gsb[0] < gsb[2]:
		print(*gsb)
	else:
		print('0 0 0')


def solve():
	n = int(input())
	num = [int(x) for x in input().split()]
	number = {}
	for i in num:
		if i not in number:
			number[i] = 1
		else:
			number[i] += 1
	number = sorted(number.items(), reverse=True)
	g = number[0][1]
	(s, b) = (0, 0)
	p = 0
	while s <= g:
		if p == len(number) - 1:
			print(0, 0, 0)
			return
		p += 1
		s += number[p][1]
	while b <= g:
		if p == len(number) - 1:
			print(0, 0, 0)
			return
		p += 1
		b += number[p][1]
	if g + s + b > n // 2:
		print(0, 0, 0)
		return
	while True:
		p += 1
		if g + s + b + number[p][1] <= n // 2:
			b += number[p][1]
		else:
			break
	print(g, s, b)
t = int(input())
for i in range(t):
	solve()


import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
ns = lambda : readline().rstrip()
ni = lambda : int(readline().rstrip())
nm = lambda : map(int, readline().split())
nl = lambda : list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')

def solve():
	n = ni()
	p = nl()
	m = [-1, -1, -1]
	for i in range(n - 1):
		if m[0] < 0 and p[i] > p[i + 1]:
			m[0] = i
		elif m[0] >= 0 and m[1] < 0 and (p[i] > p[i + 1]) and (i - m[0] > m[0] + 1):
			m[1] = i
		elif m[1] >= 0 and m[2] < 0 and (p[i] > p[i + 1]) and (i - m[1] > m[0] + 1):
			m[2] = i
		elif m[2] >= 0 and p[i] > p[i + 1] and (i < n // 2):
			m[2] = i
	if m[2] < 0 or m[2] >= n // 2:
		print(0, 0, 0)
	else:
		print(m[0] + 1, m[1] - m[0], m[2] - m[1])
	return
T = ni()
for _ in range(T):
	solve()


import sys
import math

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_string():
	return sys.stdin.readline().strip()
t = int(input())
for test in range(t):
	n = int(input())
	arr = get_array()
	g = 0
	s = 0
	b = 0
	farr = [1]
	ptr = 0
	for i in range(1, n):
		if arr[i] == arr[i - 1]:
			farr[ptr] += 1
		else:
			farr.append(1)
			ptr += 1
	if len(farr) < 2:
		print('0 0 0')
		continue
	g = farr[0]
	ptr = 1
	for i in range(ptr, len(farr)):
		if s > g:
			break
		else:
			s += farr[i]
			ptr += 1
	for i in range(ptr, len(farr)):
		if b > g:
			break
		else:
			b += farr[i]
			ptr += 1
	for i in range(ptr, len(farr)):
		if g + s + b + farr[i] <= n // 2:
			b += farr[i]
		else:
			break
	if g + s + b > n // 2 or min(g, s, b) == 0:
		print('0 0 0')
		continue
	else:
		print(g, s, b)


t = int(input())
for tt in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	if n < 10:
		print('0 0 0')
		continue
	cur = a[0]
	cnt = 1
	cnt_list = []
	for i in range(1, n):
		if cur == a[i]:
			cnt += 1
		else:
			cur = a[i]
			cnt_list.append(cnt)
			cnt = 1
	cnt_list.append(cnt)
	k = len(cnt_list)
	qsum = [None] * k
	g = cnt_list[0]
	sum_g = g
	sum_s = None
	sum_b = None
	for i in range(k):
		if i == 0:
			qsum[i] = cnt_list[i]
		else:
			qsum[i] = cnt_list[i] + qsum[i - 1]
	for i in range(k):
		if qsum[i] > 2 * sum_g:
			sum_s = qsum[i] - sum_g
			break
	if sum_s is None:
		print('0 0 0')
		continue
	b_ind = None
	for i in range(k - 1, -1, -1):
		if 2 * qsum[i] <= n:
			b_ind = i
			break
	if b_ind is None:
		print('0 0 0')
		continue
	sum_b = qsum[b_ind] - sum_g - sum_s
	if sum_b <= sum_g:
		print('0 0 0')
		continue
	if 2 * (sum_g + sum_b + sum_s) <= n:
		print(sum_g, sum_s, sum_b)
		continue
	else:
		print('0 0 0')
		continue


for _ in range(0, int(input())):
	n = int(input())
	pro = list(map(int, input().split(' ')))
	med = int(n / 2)
	mini = pro[n - 1]
	est = 'G'
	g = 0
	s = 0
	b = 0
	if len(set(pro)) >= 4:
		for i in range(0, med):
			if est == 'G':
				g += 1
			elif est == 'S':
				s += 1
			elif est == 'B' and pro[i] > mini:
				if pro[i] != pro[med - 1] or pro[med - 1] > pro[med]:
					b += 1
			if pro[i] > pro[i + 1] and est == 'G':
				est = 'S'
			elif pro[i] > pro[i + 1] and est == 'S' and (g < s):
				est = 'B'
	if g >= s or g >= b:
		g = s = b = 0
	print(str(g) + ' ' + str(s) + ' ' + str(b))


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	all = set()
	ans = [0, 0, 0]
	for i in range(n // 2):
		all.add(a[i])
	if len(all) < 3:
		print(0, 0, 0)
	else:
		new = []
		index = 0
		while index < n - 1:
			cnt = 1
			while index < n - 1 and a[index] == a[index + 1]:
				cnt += 1
				index += 1
			new.append([a[index], cnt])
			index += 1
		if a[-1] != new[-1][0]:
			new.append([a[-1], 1])
		ans = [new[0][1], 0, 0]
		index = 1
		s = 0
		while index < len(new) and new[index][1] + s <= ans[0]:
			s += new[index][1]
			index += 1
		if index < len(new):
			ans[1] = s + new[index][1]
		index += 1
		s = 0
		while index < len(new) and new[index][1] + s <= ans[0]:
			s += new[index][1]
			index += 1
		if index < len(new):
			ans[2] = s + new[index][1]
		all_sum = ans[0] + ans[1] + ans[2]
		index += 1
		while index < len(new) and all_sum + new[index][1] <= n // 2:
			ans[2] += new[index][1]
			all_sum += new[index][1]
			index += 1
		if ans[0] < ans[2] and ans[0] < ans[1] and (ans[0] * ans[1] * ans[2] != 0) and (ans[0] + ans[1] + ans[2] <= n // 2):
			print(ans[0], ans[1], ans[2])
		else:
			print(0, 0, 0)


for i in range(int(input())):
	N = int(input())
	L = list(map(int, input().split()))
	X = N // 2
	X = X - 1
	x = 0
	if L[X] == L[X + 1]:
		for j in range(X, -1, -1):
			if L[j] != L[j - 1]:
				x = j - 1
				break
		X = x
	if X < 4:
		print('0 0 0')
	else:
		j = 1
		r = 1
		while L[j] == L[j - 1] and j <= X:
			r += 1
			j += 1
		g = 0
		while j <= X and (g <= r or L[j] == L[j - 1]):
			g += 1
			j += 1
		b = X + 1 - (r + g)
		if b > r:
			print(r, g, b)
		else:
			print('0 0 0')


t = int(input())
for x in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	d = {}
	g = 0
	s = 0
	b = 0
	for i in range(len(p)):
		if p[i] in d:
			d[p[i]] += 1
		else:
			d[p[i]] = 1
	z = list(d.keys())
	a = 0
	i = 0
	while a + d[z[i]] <= n // 2:
		a += d[z[i]]
		i += 1
	g = d[z[0]]
	j = 1
	while s <= g and j < len(set(p)) - 1:
		s += d[z[j]]
		j += 1
	b = a - g - s
	if 0 < g < s and g < b:
		print(g, s, b)
	else:
		print(0, 0, 0)


from sys import stdin

def input():
	return stdin.readline()[:-1]
for _ in range(int(input())):
	n = int(input())
	v = list(map(int, input().split()))
	splits = []
	if n < 8:
		print('0 0 0')
	else:
		(a, b) = (0, n)
		for i in range(1, b):
			if v[i] < v[i - 1]:
				splits.append(i)
		if len(splits) < 3:
			print('0 0 0')
		else:
			g = splits[0]
			s = -1
			for i in range(1, len(splits)):
				if splits[i] - g > g:
					s = splits[i]
					si = i
					break
			if s == -1:
				print('0 0 0')
			else:
				ib = si + 1
				b = -1
				while ib < len(splits):
					if splits[ib] - s > g and splits[ib] <= n // 2:
						b = splits[ib]
					ib += 1
				print(g, s - g, b - s) if b != -1 else print('0 0 0')


from sys import stdin

def rl():
	return [int(w) for w in stdin.readline().split()]
(k,) = rl()
for _ in range(k):
	(n,) = rl()
	p = rl()
	g = 1
	while g < n and p[g - 1] == p[g]:
		g += 1
	s = g + 1
	while g + s < n and p[g + s - 1] == p[g + s]:
		s += 1
	a = n // 2
	while a > 0 and p[a - 1] == p[a]:
		a -= 1
	b = a - g - s
	if b > g:
		print(g, s, b)
	else:
		print(0, 0, 0)


q = int(input())
for _ in range(q):
	n = int(input())
	p = list(map(int, input().split(' ')))
	if n < 10:
		print(0, 0, 0)
		continue
	g = 0
	for i in range(n - 1):
		if p[i] > p[i + 1]:
			g = 1 + i
			break
	i = g
	s = 0
	ans = 1
	while True:
		if i == n - 1:
			ans = 0
			break
		elif s > g:
			if p[i - 1] > p[i]:
				break
			else:
				s += 1
				i += 1
		else:
			s += 1
			i += 1
	if ans == 0:
		print(0, 0, 0)
		continue
	if n % 2 == 0:
		mid = (n - 1) // 2
	else:
		mid = (n - 1) // 2 - 1
	b = 0
	for j in range(mid, i - 1, -1):
		if p[j] > p[j + 1]:
			b = j - i + 1
			break
	if g < b:
		print(g, s, b)
	else:
		print(0, 0, 0)


def fastio():
	import sys
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()
MOD = 10 ** 9 + 7
INF = 10 ** 20
I = lambda : list(map(int, input().split()))
from collections import defaultdict as dd
from math import gcd
(t,) = I()
while t:
	t -= 1
	(n,) = I()
	d = {}
	a = I()
	for i in a:
		d[i] = d.get(i, 0) + 1
	s = sorted(d.keys(), reverse=1)
	if len(s) <= 2:
		print(0, 0, 0)
		continue
	sm = 0
	i = 0
	while i < len(s) and sm + d[s[i]] <= n // 2:
		sm += d[s[i]]
		i += 1
	g = d[s[0]]
	b = d[s[1]]
	sm = sm - g - b
	j = 2
	while b <= g and j < i:
		b += d[s[j]]
		sm -= d[s[j]]
		j += 1
	if g > 0 and b > 0 and (sm > 0) and (g < b) and (g < sm):
		print(g, b, sm)
	else:
		print(0, 0, 0)


import math
import sys
from collections import defaultdict, Counter, deque, OrderedDict
import bisect
input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
ilele = lambda : map(int, input().split())
alele = lambda : list(map(int, input().split()))

def list2d(a, b, c):
	return [[c] * b for i in range(a)]
from itertools import accumulate, groupby
for _ in range(int(input())):
	N = int(input())
	A = alele()
	if N < 6:
		print(0, 0, 0)
	else:
		B = [list(g) for (k, g) in groupby(A)]
		(g, s, b) = (0, 0, 0)
		for i in B:
			if g == 0:
				g = len(i)
			elif s == 0 or s <= g:
				s += len(i)
			elif b <= g:
				b += len(i)
			elif b + s + g + len(i) <= N // 2:
				b += len(i)
			else:
				break
		if g + s + b > N // 2 or g >= s or g >= b:
			print(0, 0, 0)
		else:
			print(g, s, b)


for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	e = [0] * 3
	e[0] = 1
	t = 0
	d = 0
	for j in range(1, n):
		if l[j] == l[j - 1]:
			e[t] += 1
		elif t == 1 and e[1] <= e[0]:
			e[t] += 1
		else:
			t += 1
			if t == 2:
				d = j
				break
			e[t] += 1
	r = d
	for j in range(n // 2 - 1, d - 1, -1):
		if l[j] == l[j + 1]:
			continue
		else:
			r = j
			break
	e[2] = r - d + 1
	if e[1] > e[0] and e[2] > e[0] and (sum(e) <= n // 2):
		print(*e, sep=' ')
	else:
		print(0, 0, 0)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	g = 1
	while g < n and arr[g] == arr[g - 1]:
		g += 1
	s = g + 1
	while s + g < n and arr[g + s - 1] == arr[g + s]:
		s += 1
	index = n // 2
	while index > 0 and arr[index] == arr[index - 1]:
		index -= 1
	b = index - s - g
	if b > g:
		print(g, s, b)
	else:
		print(0, 0, 0)


for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	m = n // 2
	num = []
	count = 1
	if n != 1:
		for i in range(m - 1, -1, -1):
			if a[i] == a[m]:
				m -= 1
			else:
				break
	for i in range(m - 2, -1, -1):
		if a[i] == a[i + 1]:
			count += 1
		else:
			num.append(count)
			count = 1
	if count != 0:
		num.append(count)
	temp = 0
	if len(num) < 3:
		temp = 1
	gold = num[-1]
	rem = sum(num) - gold
	num.pop()
	silver = 0
	for i in range(len(num) - 1, 0, -1):
		silver += num[i]
		num.pop()
		if silver > gold:
			break
	bronze = 0
	for i in range(len(num) - 1, -1, -1):
		bronze += num[i]
		num.pop()
	if bronze <= gold or silver <= gold:
		temp = 1
	if temp == 1:
		print(0, 0, 0)
	else:
		print(gold, silver, bronze)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	temp = a[n // 2]
	a = a[0:n // 2]
	if len(a) < 3:
		print(0, 0, 0)
		continue
	while len(a) > 0 and a[-1] == temp:
		a.pop(-1)
	segments = []
	curr = 1
	flag = 0
	for i in range(1, len(a)):
		flag = 0
		if a[i] == a[i - 1]:
			curr += 1
		else:
			segments.append(curr)
			curr = 1
			flag = 1
	segments.append(curr)
	if len(segments) < 3:
		print(0, 0, 0)
	else:
		i = 1
		g = segments[0]
		s = segments[i]
		while i < len(segments) - 1 and s <= g:
			i += 1
			s += segments[i]
		if i == len(segments):
			print(0, 0, 0)
			continue
		if sum(segments[i + 1:len(segments)]) <= g:
			print(0, 0, 0)
			continue
		b = sum(segments[i + 1:len(segments)])
		print(g, s, b)


for t in range(int(input())):
	n = int(input())
	medals = [0, 0, 0]
	solved_prob = list(map(int, input().split()))
	positions = []
	for i in range(n // 2):
		if solved_prob[i] != solved_prob[i + 1]:
			positions.append(i + 1)
	if len(positions) < 3:
		print(*medals)
		continue
	else:
		x = positions[0]
		medals[0] = x
		positions = positions[1:]
		positions = [y - x for y in positions]
		for (i, x) in enumerate(positions):
			if x > medals[0]:
				medals[1] = x
				positions = positions[i + 1:]
				positions = [y - x for y in positions]
				break
		if len(positions) < 1:
			print('0 0 0')
			continue
		elif positions[-1] > medals[0]:
			medals[2] = positions[-1]
			print(*medals)
		else:
			print('0 0 0')


for i in range(int(input())):
	n = int(input())
	arr = [int(i) for i in input().split()]
	req = n // 2 - 1
	if n <= 4:
		print(0, 0, 0)
		continue
	if arr[req] == arr[req + 1]:
		while req >= 0 and arr[req] == arr[req + 1]:
			req -= 1
	g = s = b = 1
	ptr = 1
	while arr[ptr] == arr[0] and ptr <= req:
		g += 1
		ptr += 1
	sil = arr[ptr]
	ptr += 1
	while (s <= g or sil == arr[ptr]) and ptr <= req:
		sil = arr[ptr]
		ptr += 1
		s += 1
	b = req - ptr + 1
	if g < s and g < b:
		print(g, s, req - ptr + 1)
	else:
		print(0, 0, 0)


def get_occurences(lst):
	occl = []
	for (i, elem) in enumerate(lst):
		if not i:
			occl.append(1)
		elif elem == lst[i - 1]:
			occl[len(occl) - 1] += 1
		else:
			occl.append(1)
	return occl

def get_max_winners(occ_lst):
	n = sum(occ_lst)
	mx_w = n // 2
	cnt = 0
	idx = -1
	for (i, occ) in enumerate(occ_lst):
		if cnt + occ > mx_w:
			idx = i
			break
		else:
			cnt += occ
	return occ_lst[:idx]

def get_prizes(winners):
	if len(winners) < 3:
		return (0, 0, 0)
	gold = winners[0]
	silver = 0
	s_idx = -1
	for (i, occ) in enumerate(winners):
		if i:
			if silver > gold:
				s_idx = i
				break
			else:
				silver += occ
	bronze = 0 if s_idx == -1 else sum(winners[s_idx:])
	if not silver > gold or not bronze > gold:
		return (0, 0, 0)
	return (gold, silver, bronze)
for _ in range(int(input())):
	input()
	print(*get_prizes(get_max_winners(get_occurences(list(map(int, input().split()))))))


def func(a, total):
	d = {}
	temp = total
	for no in a:
		if total - 1 >= 0:
			total -= 1
			if no in d:
				d[no] += 1
			else:
				d[no] = 1
		else:
			if no in d:
				del d[no]
			break
	if len(d) < 3:
		return (0, 0, 0)
	gold = d[a[0]]
	del d[a[0]]
	if gold >= temp // 2 + 1:
		return (0, 0, 0)
	silver = 0
	toDelete = []
	for (key, val) in d.items():
		silver += val
		toDelete.append(key)
		if silver > gold:
			break
	for key in toDelete:
		del d[key]
	if silver <= gold:
		return (0, 0, 0)
	bronze = 0
	for (key, val) in d.items():
		bronze += val
	if bronze <= gold:
		return (0, 0, 0)
	return (gold, silver, bronze)
for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	(g, s, b) = func(a, n // 2)
	print('{} {} {}'.format(g, s, b))


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	z = n // 2
	a = []
	for i in range(z):
		if l[i] != l[z]:
			a.append(l[i])
	if len(set(a)) < 3:
		print(0, 0, 0)
	else:
		x = len(a)
		g = 1
		s = 0
		b = 1
		m = a[0]
		n = a[x - 1]
		reserved = []
		for i in range(1, x - 1):
			if a[i] == m:
				g += 1
			elif a[i] == n:
				b += 1
			else:
				s += 1
				reserved.append(a[i])
		if g < s and g < b:
			print(g, s, b)
		elif len(set(reserved)) == 1 or (g >= s and g >= b) or g >= s + b:
			print(0, 0, 0)
		else:
			reserved.reverse()
			k = []
			c = 0
			for i in range(1, len(reserved)):
				if reserved[i] > reserved[i - 1]:
					k.append(i - c)
					c = i
			for i in range(len(k)):
				if b <= g:
					b += k[i]
					s -= k[i]
			if g < s and g < b:
				print(g, s, b)
			else:
				print(0, 0, 0)


from itertools import chain
for _ in range(int(input())):
	n = int(input())
	a = []
	cur_p = -1
	cur_a = 1
	for p in chain(map(int, reversed(input().split())), (-1,)):
		if cur_p == p:
			cur_a += 1
		else:
			a.append(cur_a)
			cur_a = 1
			cur_p = p
	a.reverse()
	assert a.pop() == 1
	g = a[0]
	i = 1
	s = 0
	try:
		while s <= g:
			s += a[i]
			i += 1
		b = 0
		while (g + s + b + a[i]) * 2 <= n:
			b += a[i]
			i += 1
		if (g + s + b) * 2 > n or g >= b:
			a = [][0]
		print(g, s, b)
	except IndexError:
		print('0 0 0')


n = int(input())
from collections import Counter
from itertools import accumulate

def solve():
	k = int(input())
	l = k // 2
	arr = [int(i) for i in input().split()]
	count = Counter(arr)
	cumul = [n for (i, n) in zip(count, accumulate((i for i in count.values()))) if n <= l]
	if len(cumul) < 3:
		return '0 0 0'
	try:
		mid = next((cumul[i] for i in range(1, len(cumul)) if cumul[i] - cumul[0] > cumul[0]))
	except:
		return '0 0 0'
	if cumul[-1] - mid > cumul[0]:
		return f'{cumul[0]} {mid - cumul[0]} {cumul[-1] - mid}'
	return '0 0 0'
for _ in range(n):
	print(solve())


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	if n < 10:
		print(0, 0, 0)
		continue
	mx = a[0]
	mx2 = 0
	border = a[n // 2]
	(g, s, b) = (0, 0, 0)
	for i in range(n // 2):
		if a[i] == mx:
			g += 1
		elif s <= g or a[i] == mx2:
			s += 1
			mx2 = a[i]
		elif a[i] > border:
			b += 1
	if g < s and g < b:
		print(g, s, b)
	else:
		print(0, 0, 0)


for x in range(int(input())):
	n = int(input())
	m = list(map(int, input().split()))
	r = 'YES'
	if n < 10:
		r = 'NO'
	else:
		k = 2
		for i in range(n // 2 - 1, 2, -1):
			if m[i] > m[i + 1]:
				k = i
				break
		a = []
		p = 0
		for i in range(n // 2):
			if len(a) == 0:
				if m[i] > m[i + 1]:
					a.append(i + 1)
			else:
				p += 1
				if m[i] > m[i + 1] and p > a[0]:
					a.append(p)
					if k - i > a[0]:
						a.append(k - i)
					break
		if len(a) < 3:
			r = 'NO'
	if r == 'YES':
		print(*a)
	else:
		print(0, 0, 0)


T = int(input())
for t in range(T):
	n = int(input())
	p = list(map(int, input().split()))
	same = []
	prev_p = p[0]
	cur = 1
	for i in range(1, n):
		pi = p[i]
		if pi == prev_p:
			cur += 1
		else:
			same.append(cur)
			cur = 1
		prev_p = pi
	if cur:
		same.append(cur)
		cur = 0
	g = same[0]
	s = 0
	b = 0
	cur_s = g
	maxi = n // 2
	res = True
	cur_index = 1
	while cur_index < len(same):
		if cur_s > maxi:
			res = False
			break
		if s > g:
			q = same[cur_index]
			if cur_s + q > maxi:
				if g > s or g > b:
					res = False
				break
			b += q
			cur_s += q
			cur_index += 1
		else:
			q = same[cur_index]
			if cur_s + q > maxi:
				res = False
				break
			s += q
			cur_s += q
			cur_index += 1
	if not res or g >= s or g >= b:
		print('0 0 0')
	else:
		print('%s %s %s' % (g, s, b))


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log2, ceil
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
from bisect import insort
from collections import Counter
from collections import deque
from heapq import heappush, heappop, heapify
from itertools import permutations, combinations
mod = int(1000000000.0) + 7
ip = lambda : int(stdin.readline())
inp = lambda : map(int, stdin.readline().split())
ips = lambda : stdin.readline().rstrip()
out = lambda x: stdout.write(str(x) + '\n')
t = ip()
for _ in range(t):
	n = ip()
	arr = list(inp())
	if n <= 5:
		ans = '0 0 0'
	else:
		arr = arr[::-1]
		prev = None
		pos = -1
		if n & 1 == 1:
			val = n // 2 + 1
		else:
			val = n // 2
		for i in range(n):
			if i >= val:
				if prev == arr[i]:
					pass
				else:
					prev = arr[i]
					pos = i
					break
			if prev == arr[i]:
				pass
			else:
				prev = arr[i]
		if pos == -1:
			ans = '0 0 0'
		else:
			arr = arr[pos:]
			arr = arr[::-1]
			n = len(arr)
			if len(set(arr)) >= 3:
				ch = sorted(list(set(arr)), reverse=True)
				gold = ch[0]
				silver = ch[1]
				(g, s, b) = (0, 0, 0)
				sdic = dd(bool)
				flag = True
				for i in range(n):
					if arr[i] == gold:
						g += 1
					else:
						if s > g:
							flag = False
						if flag:
							s += 1
							sdic[arr[i]] = True
						elif sdic[arr[i]]:
							s += 1
						else:
							b += 1
				if g >= s or g >= b:
					ans = '0 0 0'
				else:
					ans = '{} {} {}'.format(g, s, b)
			else:
				ans = '0 0 0'
	out(ans)


def main():
	n = int(input())
	p = list(map(int, input().split()))
	mx = n // 2
	while mx != 0 and p[mx] == p[mx - 1]:
		mx -= 1
	(g, s, b) = (0, 0, 0)
	for i in range(mx):
		g += 1
		if p[i] != p[i + 1]:
			break
	if g == mx:
		return [0, 0, 0]
	for i in range(g, mx):
		s += 1
		if p[i] != p[i + 1] and g < s:
			break
	if g + s == mx:
		return [0, 0, 0]
	b = mx - g - s
	if g >= b:
		return [0, 0, 0]
	return [g, s, b]
t = int(input())
for i in range(t):
	print(*main())


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
testcases = int(input())
for j in range(testcases):
	n = int(input())
	vals = list(map(int, input().split()))
	dict1 = {}
	for s in range(n):
		if not vals[s] in dict1:
			dict1[vals[s]] = 1
		else:
			dict1[vals[s]] += 1
	keys = [k for k in dict1]
	keys.sort()
	keys.reverse()
	count = 0
	index = 0
	for s in range(len(keys)):
		if count + dict1[keys[s]] <= n // 2:
			count += dict1[keys[s]]
			index = s
		else:
			break
	outy = [0, 0, 0]
	for s in range(index + 1):
		if s == 0:
			outy[0] += dict1[keys[s]]
		elif outy[0] >= outy[1]:
			outy[1] += dict1[keys[s]]
		else:
			outy[2] += dict1[keys[s]]
	if outy[0] >= outy[1] or outy[0] >= outy[2]:
		print('0 0 0')
	else:
		outy = [str(k) for k in outy]
		print(' '.join(outy))


import sys
readline = sys.stdin.readline
mr = lambda : map(int, readline().split())
t = int(readline())
Ans = []
for _ in range(t):
	n = int(readline())
	monsters = list(mr())
	counter = 1
	tmpArr = []
	for i in range(1, n):
		if monsters[i] == monsters[i - 1]:
			counter += 1
		else:
			tmpArr.append(counter)
			counter = 1
	tmpArr.append(counter)
	gCount = tmpArr[0]
	sCount = 0
	bCount = 0
	sum = gCount
	for i in range(1, len(tmpArr)):
		if sCount <= gCount:
			sCount += tmpArr[i]
			sum += tmpArr[i]
		elif sum <= n // 2:
			bCount += tmpArr[i]
			sum += tmpArr[i]
		else:
			bCount -= tmpArr[i - 1]
			sum -= tmpArr[i - 1]
			break
	if sum > n // 2:
		bCount -= tmpArr[len(tmpArr) - 1]
	if sCount > gCount and bCount > gCount:
		Ans.append(str(gCount) + ' ' + str(sCount) + ' ' + str(bCount))
	else:
		Ans.append('0 0 0')
print('\n'.join(map(str, Ans)))


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	d = dict()
	l = list()
	count = 0
	l1 = list()
	g = 0
	b = 0
	s = 0
	j = 0
	for i in range(n):
		if arr[i] not in d:
			d[arr[i]] = 1
			l.append(arr[i])
		else:
			d[arr[i]] += 1
	for i in range(len(l)):
		l1.append(d[l[i]])
	summ = n // 2
	su = 0
	index = 0
	for i in range(len(l1)):
		if summ >= l1[i] + su:
			su = su + l1[i]
			index = i
		else:
			break
	if len(l) < 3:
		print('0 0 0')
	elif index < 2:
		print('0 0 0')
	else:
		g = l1[0]
		for i in range(1, index + 1):
			if s <= g:
				s = s + l1[i]
				j = i
			else:
				break
		for i in range(j + 1, index + 1):
			b = b + l1[i]
		if g == 0 or b == 0 or s == 0:
			print('0 0 0')
		elif g >= s or g >= b:
			print('0 0 0')
		else:
			print(g, s, b)


import sys

def inp():
	return sys.stdin.readline().strip()
for _ in range(int(inp())):
	n = int(inp())
	a = list(map(int, inp().split()))
	a.sort(reverse=True)
	ind = {}
	for i in range(n):
		ind[a[i]] = i
	k = sorted(ind.keys(), reverse=True)
	l = 1
	gg = ind[k[0]] + 1
	ss = 0
	while l < len(k) and gg >= ss:
		ss += ind[k[l]] - ind[k[l - 1]]
		l += 1
	bb = 0
	while l < len(k) and (bb <= gg or gg + bb + ss + ind[k[l]] - ind[k[l - 1]] <= n // 2):
		bb += ind[k[l]] - ind[k[l - 1]]
		l += 1
	if gg == 0 or bb == 0 or ss == 0 or (gg >= min(bb, ss)) or (gg + bb + ss > n // 2):
		print(0, 0, 0)
	else:
		print(gg, ss, bb)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import math
import bisect
from collections import Counter
import bisect
from collections import deque
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	c = Counter(arr)
	l = sorted([i for i in c], reverse=True)
	ans = 0
	m = len(l)
	p1 = 0
	p2 = 0
	p3 = 0
	for i in range(1):
		var = c[l[i]]
		v1 = 0
		j = i + 1
		while j < m - 2 and v1 <= var:
			v1 += c[l[j]]
			j += 1
		v2 = 0
		while (v2 <= var or var + v1 + v2 + c[l[j]] <= n // 2) and j < m - 1:
			v2 += c[l[j]]
			j += 1
		if var < v1 and var < v2 and (var + v1 + v2 <= n // 2) and (v2 > 0) and (v1 > 0):
			if var + v1 + v2 > ans:
				ans = var + v1 + v2
				p1 = var
				p2 = v1
				p3 = v2
	print(*[p1, p2, p3])


N = int(input())
for n in range(N):
	T = int(input())
	lis = [int(_) for _ in input().split()]
	gold = 1
	while gold < T and lis[gold - 1] == lis[gold]:
		gold += 1
	silver = 2 * gold + 1
	while silver < T and lis[silver - 1] == lis[silver]:
		silver += 1
	bronze = T // 2
	while bronze > 0 and lis[bronze] == lis[bronze - 1]:
		bronze -= 1
	if bronze - silver > gold:
		print(gold, silver - gold, bronze - silver)
	else:
		print(0, 0, 0)


def f():
	n = int(input())
	p = [int(s) for s in input().split()]
	memo = [[p[0], 1, 1]]
	for i in range(1, n):
		if p[i] == memo[-1][0]:
			memo[-1][1] += 1
			memo[-1][2] += 1
		else:
			newSum = memo[-1][2] + 1
			memo.append([p[i], 1, newSum])
	half = n // 2
	end = 0
	while memo[end][2] <= half:
		end += 1
	end -= 1
	if end < 2:
		print('0 0 0')
		return
	gold = 0
	if memo[gold][2] > memo[end][2] // 3:
		print('0 0 0')
		return
	silv = gold + 1
	while memo[gold][2] >= memo[silv][2] - memo[gold][2]:
		silv += 1
		if silv == end:
			print('0 0 0')
			return
	bron = silv + 1
	while memo[gold][2] >= memo[bron][2] - memo[silv][2]:
		bron += 1
		if bron > end:
			print('0 0 0')
			return
	golden = memo[gold][2]
	silver = memo[silv][2] - memo[gold][2]
	bronze = memo[end][2] - memo[silv][2]
	print('{} {} {}'.format(golden, silver, bronze))
t = int(input())
for i in range(t):
	f()


import sys
import math
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	d = {}
	l1 = []
	for i in l:
		if d.get(i, -1) == -1:
			l1.append(0)
		d[i] = d.get(i, 0) + 1
		l1[-1] = d[i]
	n1 = len(l1)
	(g, s, b) = (0, 0, 0)
	ind = -1
	suma = 0
	lmt = math.ceil(n / 2)
	for i in range(n1 - 1, -1, -1):
		suma += l1[i]
		if suma >= lmt:
			ind = i
			break
	if ind != -1:
		g_c = l1[0]
		(s_c, b_c) = (0, 0)
		for i in range(1, ind):
			s_c += l1[i]
			if s_c > g_c:
				b_c = sum(l1[i + 1:ind])
				break
		if g_c < b_c and s_c > g_c:
			print(g_c, s_c, b_c)
		else:
			print(0, 0, 0)
	else:
		print(0, 0, 0)


from itertools import groupby
IMP = '0 0 0'

def solve(n, xs):
	if n <= 5:
		return IMP
	half = n // 2
	i = half
	while i > 0 and xs[i] == xs[i - 1]:
		i -= 1
	if i == 0 and xs[i] == xs[i + 1]:
		return IMP
	ys = [(x, len(list(b))) for (x, b) in groupby(xs[:i])]
	if len(ys) < 3:
		return IMP
	g = ys[0][1]
	if 3 * g > half - 2:
		return IMP
	s = 0
	ind = 1
	while s <= g and ind < len(ys):
		s += ys[ind][1]
		ind += 1
	if s < g:
		return IMP
	b = sum((y[1] for y in ys[ind:]))
	if b <= g:
		return IMP
	return ' '.join(map(str, (g, s, b)))
for _ in range(int(input())):
	n = int(input())
	xs = [int(x) for x in input().split()]
	print(solve(n, xs))


T = int(input())
MAX = 3 * 10 ** 5 + 10
for t in range(1, T + 1):
	n = int(input())
	p = list(map(int, input().split()))
	a = []
	count = 1
	total = 0
	for i in range(1, len(p)):
		if p[i] == p[i - 1]:
			count += 1
		else:
			total += count
			if total <= n // 2:
				a.append(count)
				count = 1
			else:
				break
	if not a:
		print(0, 0, 0)
		continue
	g = a[0]
	s = 0
	b = 0
	for i in a[1:]:
		if s <= g:
			s += i
		else:
			b += i
	if s > g and b > g:
		assert g + s + b <= n // 2
		assert g > 0 and s > 0 and (b > 0)
		print(g, s, b)
	else:
		print(0, 0, 0)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))

	def getfl(a):
		(c, cc) = (1, 0)
		fl = []
		for i in range(1, len(a)):
			if a[i] == a[i - 1]:
				c += 1
			else:
				if cc + c <= n // 2:
					cc += c
					fl.append(c)
				else:
					return [fl, cc]
				c = 1
		return [fl, cc]
	(fl, total) = getfl(a)
	if len(fl) < 3:
		print('0 0 0')
		continue
	g = fl[0]
	s = 0
	poss = []
	for i in range(1, len(fl)):
		s += fl[i]
		if s > g:
			poss += [[s, total - g - s]]
	found = False
	for el in poss:
		if g < el[0] and g < el[1] and (el[1] != 0):
			print(g, el[0], el[1])
			found = True
			break
	if not found:
		print('0 0 0')


for _ in range(int(input())):
	n = int(input())
	a = [int(o) for o in input().split()]
	(g, s, b) = (0, 0, 0)
	(mg, ms, mb) = (float('inf'), float('inf'), float('inf'))
	i = 0
	while i < n // 2:
		if g == 0:
			g += 1
			mg = min(mg, a[i])
		elif a[i] == mg:
			g += 1
		elif s <= g:
			s += 1
			ms = min(ms, a[i])
		elif a[i] == ms:
			s += 1
		else:
			mb = min(mb, a[i])
			b += 1
		i += 1
	while i >= 0:
		if a[i] == a[i - 1]:
			b -= 1
			mb = max(mb, a[i - 1])
		else:
			break
		i -= 1
	if (g < b and g < s) and mg > ms > mb:
		print(g, s, b)
	else:
		print(0, 0, 0)


import sys
input = lambda : sys.stdin.readline().rstrip()

def first(m):
	cur = m[-1]
	if len(m) >= 2:
		k = 0
		while cur == m[-1]:
			del m[-1]
			if len(m) == 0:
				return False
		if len(m) <= 2:
			return False
		return m
	else:
		return False

def ge(mj):
	ans = 1
	for i in range(len(mj) - 1):
		if mj[i] == mj[i + 1]:
			ans += 1
		else:
			return ans
	return ans

def sj(mk):
	ans = 1
	for i in range(len(mk) - 1):
		if mk[i] == mk[i + 1]:
			ans += 1
		else:
			return ans
	return ans
for t in range(int(input())):
	n = int(input())
	mas = list(map(int, input().split()))
	mas = mas[:n // 2 + 1]
	mas = first(mas)
	if mas == False:
		print('0 0 0')
	else:
		g = ge(mas)
		mas = mas[g:]
		s = 0
		while s <= g:
			c = sj(mas)
			s += c
			mas = mas[c:]
		b = len(mas)
		if g == 0 or s == 0 or b == 0:
			print('0 0 0')
		elif g >= s or g >= b:
			print('0 0 0')
		else:
			print(g, s, b)


import math
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	(cnt1, cnt2, cnt3) = (0, 0, 0)
	req = n // 2
	if req < 3:
		print(0, 0, 0)
	else:
		left = 0
		while left < req and a[left] == a[left + 1]:
			cnt1 += 1
			left += 1
		cnt1 += 1
		left += 1
		right = n // 2 - 1
		while right >= 0 and a[right] == a[right + 1]:
			right -= 1
		cnt2 = cnt1 + 1
		i = cnt1 + left
		for i in range(cnt1 + left, right + 1):
			if a[i] != a[i + 1]:
				break
			cnt2 += 1
		cnt3 = right - i
		if cnt1 >= cnt2 or cnt1 >= cnt3:
			print(0, 0, 0)
		else:
			print(cnt1, cnt2, cnt3)


import math

def count(l, x):
	r = 0
	for i in l:
		if i > x:
			continue
		if x == i:
			r += 1
		else:
			break
	return r

def count2(l, a, b):
	r = 0
	for i in l:
		if i >= b:
			continue
		elif i < b and i >= a:
			r += 1
		else:
			break
	return r

def fast_del(l):
	x = l[-1]
	delind = 1
	for i in range(2, len(l) + 1):
		if l[-i] == x:
			delind += 1
		else:
			break
	return delind
T = int(input())
result = ''
for t in range(T):
	n = int(input())
	text = list(map(int, input().split(' ')))
	if len(text) > 1:
		r = math.floor(n / 2)
		students = text[:r]
		if text[r] == students[r - 1]:
			d = fast_del(students)
			students = students[:-d]
	else:
		students = text
	if not students:
		result += '0 0 0\n'
		continue
	gold = students[0]
	servial = -1
	bronze = -1
	g = count(students, gold)
	s = 0
	b = 0
	bronze = students[-1]
	for i in range(len(students) - 1, 0, -1):
		if students[i] == bronze:
			b += 1
		else:
			if b <= g:
				bronze = students[i]
				b += 1
				continue
			servial = students[i]
			break
	if servial == -1:
		result += '0 0 0\n'
		continue
	if b <= g:
		result += '0 0 0\n'
		continue
	s = count2(students, servial, gold)
	if s <= g:
		result += '0 0 0\n'
		continue
	if s == 0 and b == 0:
		g = 0
	result += str(g) + ' ' + str(s) + ' ' + str(b) + '\n'
print(result)


from sys import stdin
input = stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	half = n // 2 - 1
	while half >= 0 and half + 1 < n and (a[half + 1] == a[half]):
		half -= 1
	g = 1
	i = 0
	while i + 1 <= half and a[i] == a[i + 1]:
		g += 1
		i += 1
	i += 1
	s = 0
	b = 0
	j = i
	while j <= half:
		flag = 0
		while j + 1 <= half and a[j] == a[j + 1]:
			j += 1
		if j - i + 1 > g and half - j + 1 > g:
			s = j - i + 1
			b = half - j
			flag = 1
			break
		if flag:
			break
		j += 1
	if g < b and g < s:
		print(g, s, b)
	else:
		print(0, 0, 0)


from collections import Counter

def read_ints():
	return map(int, input().split())

def read_int():
	return int(input())
t = read_int()
for _ in range(t):
	n = read_int()
	a = list(read_ints())
	if n < 10:
		print('0 0 0')
		continue
	cut = n // 2
	if a[n // 2 - 1] == a[n // 2]:
		cut = a.index(a[n // 2])
	if cut < 5:
		print('0 0 0')
		continue
	a = a[:cut]
	g = 0
	while g < cut and a[0] == a[g]:
		g += 1
	sb = a[g:]
	if len(sb) <= 2 * g:
		print('0 0 0')
		continue
	cnt = Counter(sb)
	s = 0
	possible = False
	last = -1
	for (i, spi) in enumerate(sb):
		if last != spi:
			last = spi
			i += cnt[spi] - 1
			s += cnt[spi]
			b = len(sb) - s
			if s > g and b > g:
				print(f'{g} {s} {b}')
				possible = True
				break
	if not possible:
		print('0 0 0')
		continue


import sys
input = sys.stdin.readline
import collections
from operator import itemgetter

def main():
	t = int(input())
	for _ in range(t):
		N = int(input())
		P = [int(x) for x in input().split()]
		g = 0
		s = 0
		b = 0
		c = collections.Counter(P)
		for i in sorted(c.keys(), reverse=True):
			if g == 0:
				g = c[i]
			elif s <= g:
				s += c[i]
			else:
				if g + s + b + c[i] > N // 2:
					break
				b += c[i]
		if g < s and g < b:
			if g > 0 and b > 0 and (s > 0):
				print(g, s, b)
			else:
				print('0 0 0')
		else:
			print('0 0 0')
main()


t = int(input())

def calcMedals(l):
	half = len(l) // 2
	g = 0
	s = 0
	b = 0
	goldDone = False
	silDone = False
	silCutoff = -1
	for i in range(half):
		if goldDone == False:
			g += 1
		elif silDone == False:
			s += 1
		if l[i + 1] != l[i] and goldDone == False:
			goldDone = True
		elif l[i + 1] != l[i] and silDone == False and (s > g):
			silDone = True
			silCutoff = i
			break
	if silDone == False:
		return [0, 0, 0]
	else:
		for i in range(half - 1, silCutoff, -1):
			if l[i] != l[i + 1]:
				b = i - silCutoff
				break
		if b > g:
			return [g, s, b]
		else:
			return [0, 0, 0]
for i in range(t):
	n = int(input())
	l = list(map(int, input().strip().split()))
	medals = calcMedals(l)
	print(medals[0], medals[1], medals[2])


T = int(input())
for _ in range(T):
	n = int(input())
	a = list(map(int, input().split()))
	d = {}
	for i in a:
		d[i] = d.get(i, 0) + 1
	arr = []
	for i in d:
		arr.append([i, d[i]])
	cnt = 0
	move = []
	i = 0
	total = 0
	n = len(arr)
	while i < n:
		if len(move) == 0:
			cnt = arr[i][1]
			total = cnt
			move.append(cnt)
			i += 1
		elif len(move) == 3:
			break
		elif len(move) == 2:
			while total <= len(a) // 2 and i < n:
				total += arr[i][1]
				i += 1
			if total > n // 2:
				total -= arr[i - 1][1]
			summ = sum(move)
			if total - summ > move[0]:
				move.append(total - summ)
			break
		elif len(move) == 1:
			cnt1 = 0
			while cnt1 <= cnt and i < n:
				cnt1 += arr[i][1]
				i += 1
			move.append(cnt1)
			total += cnt1
	if len(move) == 3:
		print(*move)
	else:
		print(0, 0, 0)


from collections import deque, Counter
import array
from itertools import combinations, permutations
from math import sqrt
import unittest

def read_int():
	return int(input().strip())

def read_int_array():
	return [int(i) for i in input().strip().split(' ')]
for test in range(read_int()):
	n = read_int()
	a = read_int_array()
	g = 1
	while g < n // 2 and a[g - 1] == a[g]:
		g += 1
	s = g + 1 if g + 1 < n // 2 else n
	while s < n // 2 and (a[s - 1] == a[s] or g >= s - g):
		s += 1
	if s >= n // 2:
		b = n
	else:
		b = n // 2
		while s < b and a[b] == a[b - 1]:
			b -= 1
	if s == n or b == n or b - s <= g or (s - g <= g):
		print(0, 0, 0)
	else:
		print(g, s - g, b - s)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if n == 1:
		print(0, 0, 0)
		continue
	lim = a[n // 2]
	a = a[:n // 2]
	n = len(a)
	ind = 0
	(g, s, b) = (0, 0, 0)
	while ind < len(a):
		if a[ind] == a[0]:
			g += 1
		else:
			break
		ind += 1
	if 3 * g + 2 > len(a):
		print(0, 0, 0)
		continue
	s += g
	ind += g
	sb = ind
	while ind < len(a):
		if a[ind] == a[sb]:
			s += 1
		else:
			break
		ind += 1
	if len(a) - g - s <= g:
		print(0, 0, 0)
		continue
	while ind < len(a):
		if a[ind] != lim:
			b += 1
			ind += 1
		else:
			break
	if g < s and g < b:
		print(g, s, b)
	else:
		print(0, 0, 0)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	g = 1
	while g < n and l[g - 1] == l[g]:
		g += 1
	s = g + 1
	while g + s < n and l[s + g - 1] == l[s + g]:
		s += 1
	x = n // 2
	while x > 0 and l[x - 1] == l[x]:
		x -= 1
	ans = x - g - s
	if ans > g:
		print(g, s, ans)
	else:
		print(0, 0, 0)


def awarder(scores):
	loc = int(len(scores) / 2)
	while scores[loc] == scores[loc - 1]:
		if loc == 0:
			return '0 0 0'
		loc -= 1
	loc -= 1
	if loc < 4:
		return '0 0 0'
	index = 0
	while scores[index] == scores[index + 1]:
		index += 1
		if index + 1 >= int((loc - index) / 2):
			return '0 0 0'
	gold = index + 1
	while scores[gold + index + 1] == scores[gold + index + 2]:
		if loc - (gold + index + 1) <= gold:
			return '0 0 0'
		index += 1
	silver = index + 2
	bronze = loc - gold - silver + 1
	if gold >= bronze or gold >= silver or bronze + silver + gold > int(len(scores) / 2):
		return '0 0 0'
	return str(gold) + ' ' + str(silver) + ' ' + str(bronze)
rounds = int(input())
for i in range(rounds):
	size = input()
	numbers = input().split()
	for i in range(len(numbers)):
		numbers[i] = int(numbers[i])
	print(awarder(numbers))


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	(g, s, b) = (0, 0, 0)
	p = n // 2 - 1
	while p > 0 and a[p] == a[n // 2]:
		p -= 1
	i = 1
	g = 1
	b = 1
	while i < p and a[i] == a[0]:
		i += 1
		g += 1
		b += 1
	b += 1
	i = p - g
	p = i - 1
	while p > g and a[p] == a[i]:
		p -= 1
		b += 1
	s = p - g + 1
	if g > 0 and s > 0 and (b > 0) and (g < s) and (g < b):
		print(g, s, b)
	else:
		print(0, 0, 0)


from math import *
from collections import Counter, defaultdict, deque
from sys import stdin, stdout
input = stdin.readline
I = lambda : int(input())
M = lambda : map(int, input().split())
LI = lambda : list(map(int, input().split()))
for _ in range(I()):
	n = I()
	a = LI()
	a.sort()
	d = Counter(a)
	b = n
	c = []
	for i in d.keys():
		if b > n // 2:
			b -= d[i]
		elif i == a[-1]:
			continue
		else:
			c += [i] * d[i]
	a = d[a[-1]]
	d = Counter(c)
	b = 0
	c = 0
	for i in d.keys():
		if c <= a:
			c += d[i]
		else:
			b += d[i]
	if a >= b or a >= c:
		print(0, 0, 0)
	else:
		print(a, b, c)


def mi():
	return map(int, input().split())
for _ in range(int(input())):
	n = int(input())
	a = list(mi())
	m = n // 2 - 1
	while m >= 0 and m + 1 < n and (a[m] == a[m + 1]):
		m -= 1
	m += 1
	m = min(m, n // 2)
	a = a[:m]
	if m <= 2 or max(a) - min(a) <= 1:
		print(0, 0, 0)
		continue
	(g, s, b) = (1, 0, 0)
	for i in range(1, m):
		if a[i] == a[i - 1]:
			if s == 0:
				g += 1
			elif b == 0 or g >= s:
				s += 1
			else:
				b += 1
		elif s == 0 or g >= s:
			s += 1
		else:
			b += 1
	if g >= b or g >= s or g == 0 or (b == 0) or (s == 0):
		print(0, 0, 0)
	else:
		print(g, s, b)


import sys
input = sys.stdin.readline
Q = int(input())
Query = []
for _ in range(Q):
	N = int(input())
	A = list(map(int, input().split()))
	Query.append((N, A))
for (N, A) in Query:
	B = []
	b = 0
	pre = A[0]
	for a in A:
		if a == pre:
			b += 1
		else:
			B.append(b)
			b = 1
		pre = a
	if b > 0:
		B.append(b)
	H = N // 2
	if len(B) < 3:
		print(0, 0, 0)
	else:
		a1 = B[0]
		a2 = B[1]
		sa = 1
		for i in range(2, len(B)):
			if a2 > a1:
				break
			a2 += B[i]
			sa = i
		if sa == len(B) - 1:
			print(0, 0, 0)
		else:
			a3 = B[sa + 1]
			s = a1 + a2 + a3
			if s > H:
				print(0, 0, 0)
			else:
				for i in range(sa + 2, len(B)):
					if s + B[i] > H:
						break
					else:
						a3 += B[i]
						s += B[i]
				if a3 <= a1:
					print(0, 0, 0)
				else:
					print(a1, a2, a3)


def find_medalist(c_ps_sorted, n):
	total = 0
	included = []
	while c_ps_sorted and total + c_ps_sorted[-1][1] <= n // 2:
		total += c_ps_sorted[-1][1]
		included.append(c_ps_sorted.pop())
	included.reverse()
	return included

def medalist_numbers(included):
	try:
		gold = included.pop()
		silver = included.pop()
		while silver[1] <= gold[1]:
			new = included.pop()
			silver[0] = new[0]
			silver[1] = new[1] + silver[1]
	except IndexError:
		return (0, 0, 0)
	if not included:
		return (0, 0, 0)
	bronze = (min((e[0] for e in included)), sum((e[1] for e in included)))
	if bronze[1] <= gold[1]:
		return (0, 0, 0)
	return (gold[1], silver[1], bronze[1])
from collections import Counter
t = int(input())
for __ in range(t):
	n = int(input())
	ps = list(map(int, input().split()))
	c_ps = Counter(ps)
	c_ps_sorted = []
	for (val, cnt) in c_ps.items():
		c_ps_sorted.append([val, cnt])
	c_ps_sorted.sort()
	included = find_medalist(c_ps_sorted, n)
	print(*medalist_numbers(included))


from collections import Counter
t = int(input())
for _ in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	c = Counter(p)
	problem_classes = sorted(c.keys(), reverse=True)
	if len(problem_classes) < 4:
		print('0 0 0')
		continue
	gold = c[problem_classes[0]]
	(silver, i) = (0, 1)
	while silver <= gold and i < len(problem_classes):
		(silver, i) = (silver + c[problem_classes[i]], i + 1)
	bronze = 0
	while bronze <= gold and i < len(problem_classes):
		(bronze, i) = (bronze + c[problem_classes[i]], i + 1)
	if gold + silver + bronze > n // 2:
		print('0 0 0')
		continue
	else:
		while i < len(problem_classes):
			if gold + silver + bronze + c[problem_classes[i]] <= n // 2:
				(bronze, i) = (bronze + c[problem_classes[i]], i + 1)
			else:
				break
	print(gold, silver, bronze)


t = int(input())
while t:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	if n <= 2:
		print(0, 0, 0)
		continue
	b = dict()
	for i in a:
		if i not in b:
			b[i] = 1
			continue
		b[i] += 1
	ma = n // 2
	res = [0] * 3
	z = 0
	co = 0
	for i in b.keys():
		if co == 0:
			res[0] = b[i]
			co += 1
			su = res[0]
		else:
			su += b[i]
			if su > ma:
				break
			res[co] += b[i]
			if res[co] > res[0]:
				if co != 2:
					co += 1
	if 0 in res or res[0] >= res[1] or res[0] >= res[2]:
		print(0, 0, 0)
		continue
	print(*res)


t = int(input())
while t:
	n = int(input())
	p = input().split()
	for i in range(n):
		p[i] = int(p[i])
	a = []
	for i in range(min(n // 2, n - 1)):
		if p[i] - p[i + 1] > 0:
			a.append(i)
	if len(a) >= 2:
		g = a[0]
		s = 0
		b = 0
		for i in range(1, len(a)):
			if s <= g + 1:
				s += a[i] - a[i - 1]
			else:
				b += a[i] - a[i - 1]
		if s > g + 1 and b > g + 1:
			print(g + 1, s, b)
		else:
			print(0, 0, 0)
	else:
		print(0, 0, 0)
	t -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	if n < 5:
		print(0, 0, 0)
		continue
	n_medals = n // 2
	pts = []
	idx = 0
	while idx < n:
		cnt = 0
		pt = p[idx]
		while idx < n and pt == p[idx]:
			idx += 1
			cnt += 1
		pts.append(cnt)
	g = pts[0]
	n_medals -= g
	s = 0
	idx = 1
	while s <= g and idx < len(pts):
		s += pts[idx]
		idx += 1
	n_medals -= s
	b = 0
	while idx < len(pts):
		if pts[idx] <= n_medals:
			n_medals -= pts[idx]
			b += pts[idx]
			idx += 1
		else:
			break
	if b <= g:
		print(0, 0, 0)
	else:
		print(g, s, b)


from collections import Counter
t = int(input())
for _ in range(t):
	n = int(input())
	half = n // 2
	cnt = Counter(map(int, input().split()))
	a = [v for (_, v) in sorted(cnt.items(), reverse=True)]
	(ok, ng) = (0, half)
	ans = [0, 0, 0]
	while ng - ok > 1:
		mid = (ok + ng) // 2
		(count, t) = ([0, 0, 0], 0)
		total = 0
		for v in a:
			if t == 2 and total + v > half:
				break
			count[t] += v
			total += v
			if t == 0 and count[0] >= mid or (t == 1 and count[0] < count[t]):
				t += 1
		if min(count) > 0 and count[0] < count[1] and (count[0] < count[2]) and (total <= half):
			ok = mid
			ans = count[:]
		else:
			ng = mid
	print(*ans)


import bisect
import collections
import copy
import functools
import heapq
import itertools
import math
import random
import re
import sys
import time
import string
from typing import List
sys.setrecursionlimit(99999)
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	if n < 5:
		print('0 0 0')
		continue
	(g, s, b) = (0, 0, 0)
	score = [[arr[0], 1]]
	for c in arr[1:]:
		if c == score[-1][0]:
			score[-1][1] += 1
		else:
			score.append([c, 1])
	g = score[0][1]
	j = 1
	while s <= g and j < len(score):
		s += score[j][1]
		j += 1
	while j < len(score) and g + s + b + score[j][1] <= n // 2:
		b += score[j][1]
		j += 1
	if g > 0 and s > 0 and (b > 0) and (g < s) and (g < b):
		print(g, s, b)
		continue
	else:
		print('0 0 0')
		continue


q = int(input())
for t in range(q):
	n = int(input())
	a = list(map(int, input().split()))
	p = []
	pod = 1
	for i in range(1, n):
		if a[i] == a[i - 1]:
			pod += 1
		else:
			p.append(pod)
			pod = 1
	p.append(pod)
	med = p[0]
	g = p[0]
	s = 0
	uk1 = 1
	while uk1 < len(p) and s <= g:
		s += p[uk1]
		uk1 += 1
	if s <= g or s + g > n // 2:
		print('0 0 0')
	else:
		b = 0
		while uk1 < len(p):
			if b + g + s + p[uk1] <= n // 2:
				b += p[uk1]
				uk1 += 1
			else:
				break
		if b <= g or b + g + s > n // 2:
			print('0 0 0')
		else:
			print(g, s, b)


import math
t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(p) for p in input().split()]
	if n < 5:
		print(0, 0, 0)
		continue
	piv = arr[n // 2]
	q = n // 2 - 1
	while arr[q] == piv and q >= 0:
		q -= 1
	freq = {}
	for i in range(q + 1):
		if arr[i] not in freq:
			freq[arr[i]] = 1
		else:
			freq[arr[i]] += 1
	(g, s, b) = (0, 0, 0)
	for i in freq:
		if g == 0:
			g += freq[i]
		elif s <= g:
			s += freq[i]
		else:
			b += freq[i]
	if not any([g, b, s]) or (g >= b or g >= s):
		print(0, 0, 0)
	else:
		print(g, s, b)


def f(L):
	M = [1]
	n = len(L)
	if n < 3:
		return [0, 0, 0]
	medals = [0, 0, 0]
	counter = 0
	for i in range(1, len(L)):
		if L[i - 1] == L[i]:
			M[-1] += 1
		else:
			M.append(1)
	if len(M) < 3:
		return [0, 0, 0]
	medals[0] = M[0]
	medals[1] = M[1]
	counter = M[0] + M[1]
	k = 2
	while medals[0] >= medals[1] and k < len(M):
		medals[1] += M[k]
		counter += M[k]
		k += 1
	if counter * 2 > n:
		return [0, 0, 0]
	if medals[0] >= medals[1]:
		return [0, 0, 0]
	else:
		while counter * 2 <= n and k < len(M):
			if (counter + M[k]) * 2 <= n:
				counter += M[k]
				medals[2] += M[k]
				k += 1
			else:
				break
	if medals[2] <= medals[0]:
		return [0, 0, 0]
	else:
		return medals
for i in ' ' * int(input()):
	n = int(input())
	for i in f(list(map(int, input().split()))):
		print(i, end=' ')
	print()


def solve():
	n = int(input())
	p = list(map(int, input().split()))
	g = 0
	s = 0
	b = 0
	if len(p) > 0:
		ll = p[-1]
		while len(p) > 0 and p[-1] == ll:
			p.pop()
	maxm = n // 2
	if len(p) > maxm:
		l = p[maxm]
		while len(p) > maxm or (len(p) > 0 and p[-1] == l):
			p.pop()
	gs = []
	i = 0
	c = 0
	if len(p) > 0:
		i = 1
		c = 1
	while i < len(p):
		if i < len(p):
			if p[i] == p[i - 1]:
				c += 1
				i += 1
			else:
				gs.append(c)
				if i + 1 < len(p):
					c = 1
				else:
					c = 1
				i += 1
		else:
			gs.append(c)
			if i + 1 < len(p):
				c = 1
			else:
				c = 0
			i += 1
	gs.append(c)
	while len(gs) > 0 and gs[-1] == 0:
		gs.pop()
	if len(gs) < 3:
		pass
	else:
		g = gs[0]
		i = 0
		su = 0
		for i in range(1, len(gs)):
			su += gs[i]
			if su > g:
				break
		s = su
		su = 0
		for j in range(i + 1, len(gs)):
			su += gs[j]
		b = su
	if g <= 0 or s <= 0 or b <= 0 or (g >= s or g >= b):
		g = 0
		s = 0
		b = 0
	print(g, s, b)
for _ in range(int(input())):
	solve()


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	diff = 0
	d = {}
	if n > 5:
		sum1 = 0
		for i in range(n):
			if d.get(l[i]) == None:
				diff += 1
				d[l[i]] = 1
			else:
				d[l[i]] += 1
			sum1 += 1
			if sum1 > n // 2:
				sum1 -= d[l[i]]
				d[l[i]] = 0
				diff -= 1
				break
		if diff < 3:
			print('0 0 0')
		else:
			sum = 0
			for i in d:
				if i == l[0]:
					continue
				else:
					sum += d[i]
				if sum > d[l[0]]:
					break
			if sum > d[l[0]] and sum1 - sum - d[l[0]] > d[l[0]]:
				print(d[l[0]], sum, sum1 - sum - d[l[0]])
			else:
				print('0 0 0')
	else:
		print('0 0 0')


from math import ceil
from math import factorial
from collections import Counter
from operator import itemgetter
ii = lambda : int(input())
iia = lambda : list(map(int, input().split()))
isa = lambda : list(input().split())
t = ii()
for i in range(t):
	n = ii()
	a = iia()
	d = Counter(a)
	d = sorted(d.items(), key=itemgetter(0), reverse=True)
	s = 0
	x = []
	for i in range(n):
		if s + d[i][1] <= n // 2:
			s += d[i][1]
			x.append(d[i][1])
		else:
			break
	if s < 5:
		print('0 0 0')
	else:
		k = 0
		if len(x) > 1:
			for i in range(1, len(x)):
				if k <= x[0]:
					k += x[i]
		g = x[0]
		b = s - x[0] - k
		s = k
		if g < s and g < b:
			print(g, s, b)
		else:
			print('0 0 0')


t = int(input())
for w in range(t):
	n = int(input())
	p = [int(i) for i in input().split()]
	(g, s, b) = (0, 0, 0)
	mid = n // 2
	if mid < 3:
		print(g, s, b)
		continue
	maxG = max(p)
	lastGoldInx = -1
	lastSilverInx = -1
	check = []
	repeatNum = 0
	for i in range(mid):
		check.append(p[i])
	check = list(set(check))
	if len(check) == 1 or len(check) == 2:
		print(g, s, b)
		continue
	for i in range(mid):
		if p[i] == maxG:
			g += 1
			lastGoldInx = i
		else:
			break
	maxS = p[lastGoldInx + 1]
	for i in range(lastGoldInx + 1, mid):
		if p[i] == maxS or s < g + 1:
			s += 1
			lastSilverInx = i
	if p[lastSilverInx + 1] == p[lastSilverInx]:
		repeatNum = p[lastSilverInx]
	for i in range(lastSilverInx + 1, mid):
		if p[i] == repeatNum:
			s += 1
			lastSilverInx = i
		else:
			break
	if p[mid - 1] == p[mid]:
		repeatNum = p[mid - 1]
	for i in range(lastSilverInx + 1, mid):
		if p[i] != repeatNum:
			b += 1
	if (b == 0 or s == 0 or g == 0) or b <= g or s <= g:
		print(0, 0, 0)
	else:
		print(g, s, b)


import sys

def rint():
	return map(int, sys.stdin.readline().split())

def input():
	return sys.stdin.readline().rstrip('\n')

def oint():
	return int(input())
t = oint()
for _ in range(t):
	n = oint()
	p = list(rint())
	s = [1]
	mid = n // 2
	for i in range(1, mid):
		if p[i - 1] == p[i]:
			s[-1] += 1
		else:
			s.append(1)
	if p[mid] == p[mid - 1]:
		s.pop()
	if len(s) < 3:
		print('0 0 0')
		continue
	gg = s[0]
	ss = 0
	bb = 0
	tot = sum(s[1:])
	for i in range(1, len(s)):
		ss += s[i]
		bb = tot - ss
		if gg < ss and gg < bb and (bb > 0):
			break
	else:
		print('0 0 0')
		continue
	print(gg, ss, bb)


t = int(input())
for case in range(t):
	n = int(input())
	p = [int(x) for x in input().split(' ')]
	p_dict = {}
	for x in p:
		if x in p_dict.keys():
			p_dict[x] += 1
		else:
			p_dict[x] = 1
	p = [(k, v) for (k, v) in p_dict.items()]
	p.sort(reverse=True)
	p = [x[1] for x in p]
	m = [p[0], 0, 0]
	j = 1
	for i in range(1, len(p)):
		if j > 2:
			break
		if sum(m) + p[i] > n // 2:
			break
		elif j == 1 and m[j] > m[j - 1]:
			j += 1
		m[j] += p[i]
	if min(m) == 0 or m[2] <= m[0]:
		m = [0, 0, 0]
	print(*m)


x = int(input())
W = []
for j in range(x):
	a = int(input())
	A = list(map(int, input().split()))
	B = [[A[0], 1]]
	for i in range(1, a):
		if A[i] == A[i - 1]:
			B[-1][1] += 1
		else:
			B.append([A[i], 1])
	qwer = 0
	for i in range(len(B)):
		qwer += B[i][1]
	qwe = 0
	i = 0
	while qwe + B[i][1] <= qwer // 2:
		qwe += B[i][1]
		i += 1
	ANS = [0, 0, 0]
	if i >= 3:
		if qwe > B[0][1] * 3:
			qwed = 0
			i = 1
			while qwed <= B[0][1]:
				qwed += B[i][1]
				i += 1
			if B[0][1] < qwe - B[0][1] - qwed:
				ANS = [B[0][1], qwed, qwe - B[0][1] - qwed]
	W.append(ANS)
for a in W:
	print(*a)


for _ in range(int(input())):
	n = int(input())
	point = list(map(int, input().split()))
	gold = 1
	bronze = 1
	silver = 1
	best = 0
	while gold < n:
		if point[gold] != point[gold - 1]:
			break
		gold += 1
	silver = gold + 1
	while gold + silver < n - 1:
		if point[gold + silver - 1] != point[gold + silver]:
			break
		silver += 1
	bronze = gold + 1
	while gold + silver + bronze < n - 1:
		if point[gold + silver + bronze - 1] != point[gold + silver + bronze]:
			break
		bronze += 1
	if gold + silver + bronze > n // 2:
		bronze = silver = gold = 0
	else:
		src = n // 2 - 1
		while point[src] == point[src + 1]:
			src -= 1
		bronze = src + 1 - gold - silver
	print(gold, silver, bronze)


from itertools import combinations
import sys
input = sys.stdin.readline
INF = 10 ** 9
t = int(input())
for i in range(t):
	n = int(input())
	a = [int(item) for item in input().split()]
	miss_medal = a[n // 2]
	lim = a.index(miss_medal)
	g = a[0]
	s = -1
	g_cnt = 0
	s_cnt = 0
	b_cnt = 0
	state = 0
	for i in range(lim):
		if state == 0:
			if a[i] == g:
				g_cnt += 1
			else:
				s = a[i]
				s_cnt += 1
				state = 1
			continue
		if state == 1:
			if a[i] == s:
				s_cnt += 1
			elif s_cnt <= g_cnt:
				s = a[i]
				s_cnt += 1
			else:
				b = a[i]
				b_cnt += 1
				state = 2
				continue
		if state == 2:
			b_cnt = lim - i + 1
			break
	if g_cnt < s_cnt and g_cnt < b_cnt:
		print(g_cnt, s_cnt, b_cnt)
	else:
		print(0, 0, 0)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if n < 6:
		print(0, 0, 0)
	else:
		(g, s, b) = (1, 0, 0)
		i = 1
		while i < n // 2 and a[i] == a[i - 1]:
			g += 1
			i += 1
		if i >= n // 2:
			print(0, 0, 0)
			continue
		s = 1
		i += 1
		while i < n // 2 and (a[i] == a[i - 1] or s <= g):
			s += 1
			i += 1
		if i >= n // 2:
			print(0, 0, 0)
		else:
			start = i
			i = n // 2
			i -= 1
			b = n // 2 - (g + s)
			while a[i] == a[i + 1]:
				b -= 1
				i -= 1
			if g < s and g < b and (g > 0) and (b > 0) and (s > 0) and (g + s + b <= n // 2):
				print(g, s, b)
			else:
				print(0, 0, 0)


import os
from io import BytesIO, IOBase
import sys
from collections import defaultdict, deque, Counter
from math import sqrt, pi, ceil, log, inf, gcd, floor
from itertools import combinations, permutations
from bisect import *
from fractions import Fraction

def main():
	for _ in range(int(input())):
		n = int(input())
		p = list(map(int, input().split()))
		a = Counter(p)
		b = sorted(set(p), reverse=True)
		(c, i, j) = ([0, 0, 0], 0, 0)
		for i in range(len(b)):
			if a[b[i]] + sum(c) > n // 2:
				break
			if j == 0:
				c[0] = a[b[i]]
				j = 1
			elif j == 1:
				c[1] += a[b[i]]
				j += c[0] < c[1]
			else:
				c[j] += a[b[i]]
		if 0 in c or c[0] >= c[1] or c[0] >= c[2]:
			print(0, 0, 0)
		else:
			print(*c)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


from math import *
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	f = ceil(n / 2)
	ind = 0
	x = 0
	for i in range(f):
		m = a.pop()
		if i == f - 1:
			x = m
	f = len(a)
	for i in range(f - 1, -1, -1):
		if a[i] == x:
			a.pop()
	g = list()
	s = list()
	b = list()
	n = len(a)
	if n > 0:
		g.append(a[0])
		for i in range(1, n - 1):
			if a[i] == a[i - 1]:
				g.append(a[i])
			else:
				ind = i
				break
		else:
			ind = -1
	if ind > 0:
		while len(s) <= len(g):
			try:
				s.append(a[ind])
				ind += 1
			except:
				ind = -1
		for i in range(ind, n - 1):
			if a[i] == a[i - 1]:
				s.append(a[i])
			else:
				ind = i
				break
		else:
			ind = -1
	if ind > 0:
		b.append(a[ind])
		for i in range(ind + 1, n):
			b.append(a[i])
	if len(g) < len(s) and len(g) < len(b) and (len(g) > 0) and (len(s) > 0) and (len(b) > 0):
		print(len(g), len(s), len(b))
	else:
		print(0, 0, 0)


import sys
import math
import bisect
sys.setrecursionlimit(1000000000)

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def finput():
	return float(input())

def tinput():
	return input().split()

def rinput():
	return map(int, tinput())

def rlinput():
	return list(rinput())

def main():
	n = iinput()
	c = rlinput()
	q = n // 2
	w = [[c[0], 0]]
	for i in c:
		if w[-1][0] == i:
			w[-1][1] += 1
		else:
			w.append([i, 1])
	(res1, res2, res3) = (0, 0, 0)
	if len(w) <= 3:
		print(0, 0, 0)
	else:
		res1 = w[0][1]
		res2 = w[1][1]
		i = 2
		n = len(w)
		while res1 >= res2 and i != n:
			res2 += w[i][1]
			i += 1
		s = res1 + res2
		while i != n and w[i][1] + s <= q:
			s += w[i][1]
			res3 += w[i][1]
			i += 1
		if s > q or res1 * res2 * res3 == 0 or res1 >= res2 or (res3 <= res1):
			print(0, 0, 0)
		else:
			print(res1, res2, res3)
for j in range(int(input())):
	main()


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	(g, s, b, c) = (0, 0, 0, 0)
	i = 0
	ct = []
	while i < n:
		t = a[i]
		c = 0
		while t == a[i]:
			c = c + 1
			i = i + 1
			if i == n:
				break
		ct.append(c)
	for i in range(len(ct)):
		if i == 0:
			g = ct[i]
		elif s <= g:
			s = s + ct[i]
		elif b <= g or g + s + b < n // 2:
			if g + s + b + ct[i] > n // 2:
				break
			else:
				b = b + ct[i]
	if g == 0 or b == 0 or s == 0 or (g + s + b > n // 2) or (b <= g) or (s <= g):
		print(0, 0, 0)
	else:
		print(g, s, b)


from sys import maxsize, stdout, stdin, stderr
mod = int(1000000000.0 + 7)
import sys

def I():
	return int(stdin.readline())

def lint():
	return [int(x) for x in stdin.readline().split()]

def S():
	return input().strip()

def grid(r, c):
	return [lint() for i in range(r)]
from collections import defaultdict, Counter
import math
import heapq
from heapq import heappop, heappush
import bisect
from itertools import groupby

def gcd(a, b):
	while b:
		a %= b
		tmp = a
		a = b
		b = tmp
	return a

def lcm(a, b):
	return a // gcd(a, b) * b

def check_prime(n):
	for i in range(2, int(n ** (1 / 2)) + 1):
		if not n % i:
			return False
	return True

def Bs(a, x):
	i = 0
	j = 0
	left = 1
	right = x
	flag = False
	while left < right:
		mi = (left + right) // 2
		if a[mi] <= x:
			left = mi + 1
			i += 1
		else:
			right = mi
			j += 1
	if left > 0 and a[left - 1] == x:
		return (i - 1, j)
	else:
		return (-1, -1)

def nCr(n, r):
	return fact(n) // (fact(r) * fact(n - r))

def fact(n):
	res = 1
	for i in range(2, n + 1):
		res = res * i
	return res

def primefactors(n):
	num = 0
	while n % 2 == 0:
		num += 1
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			num += 1
			n = n // i
	if n > 2:
		num += 1
	return num

def ask(a):
	print('? {}'.format(a), flush=True)
	n = I()
	return n

def dfs(i, p):
	(a, tmp) = (0, 0)
	for j in d[i]:
		if j != p:
			a += 1
			tmp += dfs(j, i)
	if a == 0:
		return 0
	return tmp / a + 1

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n // 2
	if n > 2:
		l.append(n)
	return l
k = I()
for _ in range(k):
	n = I()
	q = lint()
	d = Counter(q)
	t = list(set(q.copy()))
	t.sort(reverse=True)
	(g, s, b) = (0, 0, 0)
	l = [d[t[0]]]
	for i in range(1, len(t)):
		l.append(d[t[i]] + l[-1])
		if l[-1] > n // 2:
			break
	l = [0] + l
	i = len(l) - 2
	g = l[1]
	while i > 1:
		if b <= g:
			b += l[i] - l[i - 1]
		else:
			s += l[i] - l[1]
			break
		i -= 1
	if min(g, s, b) > 0 and g < min(s, b) and (g + s + b <= n // 2):
		print(g, s, b)
	else:
		print(0, 0, 0)


from collections import Counter

def abc(nums: list, l: int):
	if len(nums) < 10:
		return '0 0 0'
	dic = Counter(nums)
	keys = sorted(dic, reverse=True)
	if len(keys) < 3:
		return '0 0 0'
	gold = dic[keys[0]]
	silver = 0
	bronze = 0
	target = l // 2
	needle = 1
	for i in keys[1:]:
		silver += dic[i]
		needle += 1
		if silver > gold:
			break
	else:
		return '0 0 0'
	for i in keys[needle:]:
		bronze += dic[i]
		needle += 1
		if bronze > gold:
			break
	else:
		return '0 0 0'
	if gold + silver + bronze > target:
		return '0 0 0'
	for i in keys[needle:]:
		if gold + silver + bronze + dic[i] > target:
			return '%d %d %d' % (gold, silver, bronze)
		bronze += dic[i]
	return '%d %d %d' % (gold, silver, bronze)
t = int(input())
out = []
for i in range(t):
	a = int(input())
	s = list(map(int, input().split(' ')))
	out.append(abc(s, a))
for i in out:
	print(i)


from collections import Counter
from collections import defaultdict
import math
import bisect
t = int(input())
for _ in range(0, t):
	n = int(input())
	a = list(map(int, input().split()))
	d = defaultdict(lambda : 0)
	s = a[0]
	d[s] = 1
	ans = 1
	l = [a[0]]
	if n < 5:
		print('0 0 0')
		continue
	for i in range(1, n // 2):
		if a[i] == s:
			d[a[i]] = d[a[i]] + 1
		else:
			s = a[i]
			d[a[i]] = 1
			l.append(a[i])
	ans = d[a[0]]
	a2 = a[n // 2 - 1]
	if a2 == a[n // 2]:
		l.remove(a[n // 2 - 1])
	c = 0
	s2 = 0
	k = 0
	f1 = 0
	f2 = 0
	for i in range(1, len(l)):
		c = c + d[l[i]]
		if c > ans:
			s2 = c
			k = i
			f1 = 1
			break
	c = 0
	for i in range(k + 1, len(l)):
		c = c + d[l[i]]
		if c > ans:
			f2 = 1
			s3 = c
	if f1 and f2:
		print(ans, s2, s3)
	else:
		print('0 0 0')


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	n = n // 2
	if n < 5:
		print(0, 0, 0)
		continue
	lengths = []
	j = 0
	for i in range(1, n):
		if arr[i] != arr[i - 1]:
			lengths.append(i - j)
			j = i
	if arr[n] != arr[n - 1]:
		lengths.append(n - j)
	if len(lengths) < 3:
		print(0, 0, 0)
		continue
	G = lengths[0]
	S = 0
	k = 1
	while S <= G and k < len(lengths):
		S += lengths[k]
		k += 1
	B = sum(lengths) - G - S
	if G < S and G < B:
		print(G, S, B)
	else:
		print(0, 0, 0)


import sys
t = int(input())
for i in range(t):
	n = int(sys.stdin.readline())
	a = list(map(int, sys.stdin.readline().strip().split()))
	x = n // 2
	g = 0
	s = 0
	b = 0
	xx = 0
	gend = 0
	bend = 0
	send = 0
	bstart = 0
	if n < 10:
		print(g, s, b)
		continue
	for j in range(x):
		if a[j] > a[j + 1]:
			gend = j
			break
	g = gend + 1
	for j in range(x, gend, -1):
		if a[j - 1] > a[j]:
			xx = j - 1
			break
	bend = xx
	cc = 0
	for j in range(bend, gend, -1):
		cc += 1
		if a[j - 1] > a[j] and cc > g:
			b = cc
			bstart = j - 1
			break
	send = bstart
	if a[gend + 1] > a[bend]:
		s = send - gend
		b = bend - send
	if s > g and b > g:
		print(g, s, b)
	else:
		print(0, 0, 0)


import os
import operator
from collections import defaultdict
import sys
from io import BytesIO, IOBase
import bisect

def main():
	for _ in range(int(input())):
		n = int(input())
		arr = [int(k) for k in input().split()]
		if len(arr) <= 9:
			print(0, 0, 0)
			continue
		g = 0
		s = 0
		b = 0
		new = []
		dic = defaultdict(int)
		for i in range(n):
			dic[arr[i]] += 1
		k = 0
		for (key, item) in dic.items():
			if k + item <= n // 2:
				new.append(item)
				k += item
			else:
				break
		if len(new) <= 2:
			print(0, 0, 0)
			continue
		j = len(new) - 1
		g = new[0]
		while b <= g:
			b += new[j]
			j -= 1
		s = k - (g + b)
		if g < s and g < b:
			print(g, s, b)
		else:
			print(0, 0, 0)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


from sys import stdin
from collections import deque
from math import sqrt, floor, ceil, log, log2, log10, pi, gcd, sin, cos, asin

def ii():
	return int(stdin.readline())

def fi():
	return float(stdin.readline())

def mi():
	return map(int, stdin.readline().split())

def fmi():
	return map(float, stdin.readline().split())

def li():
	return list(mi())

def lsi():
	x = list(stdin.readline())
	x.pop()
	return x

def si():
	return stdin.readline()

def out():
	print(0, 0, 0)
for _ in range(ii()):
	n = ii()
	a = li()
	g = s = b = 0
	f = 1
	if a[0] > 2 and n > 9:
		x = n // 2
		x -= 1
		if a[x] == a[x + 1]:
			f = 0
			for i in range(x, 3, -1):
				if a[i] != a[x]:
					x = i
					f = 1
					break
		if f:
			for i in range(1, x + 1):
				if a[i] != a[0]:
					g = i
					break
			for i in range(g + 1, x + 1):
				if a[i] != a[i - 1] and g < i - g:
					s = i - g
					break
			if a[x] != a[s + g - 1] and g < x + 1 - (g + s):
				b = x + 1 - (g + s)
			if g >= s or g >= b:
				out()
			else:
				print(g, s, b)
		else:
			out()
	else:
		out()


t = int(input())
for j in range(t):
	n = int(input())
	P = list(map(int, input().split()))
	if n < 5:
		print(0, 0, 0)
	else:
		g = 0
		s = 0
		b = 0
		m = P[0]
		i = 0
		while i < n and P[i] == m:
			g += 1
			i += 1
		while i < n and s <= g:
			s += 1
			i += 1
		m = P[i - 1]
		while i < n and P[i] == m:
			s += 1
			i += 1
		while i < n and b <= g:
			b += 1
			i += 1
		m = P[i - 1]
		while i < n and P[i] == m:
			b += 1
			i += 1
		m = P[i - 1]
		k = 0
		while i < n // 2 + 1:
			if P[i] == m:
				i += 1
				k += 1
			else:
				b += k
				m = P[i]
				k = 1
				i += 1
		if g + b + s > n // 2 or g >= b or g >= s:
			print(0, 0, 0)
		else:
			print(g, s, b)


from collections import Counter, defaultdict
import math
t = int(input())
for _ in range(t):
	n = int(input())
	ls = list(map(int, input().strip().split()))
	if n < 3:
		print('0 0 0')
		continue
	wins = ls[:n // 2].copy()
	templs = ls[n // 2:].copy()
	ls.clear()
	ls = templs[:].copy()
	check = wins[-1]
	count_dic = defaultdict(int)
	medals = 0
	if ls.count(check) > 0:
		temp = []
		for val in wins:
			if val == check:
				break
			temp.append(val)
			medals += 1
			count_dic[val] += 1
		wins.clear()
		wins = temp.copy()
	else:
		for val in wins:
			medals += 1
			count_dic[val] += 1
	if len(count_dic) < 3:
		print('0 0 0')
	else:
		max_gold_medals = medals / 3
		max_gold_medals = math.floor(max_gold_medals)
		gold = silver = bronze = 0
		while gold >= silver or gold >= bronze:
			temp_max_gold_medals = max_gold_medals
			gold = silver = bronze = 0
			for (key, val) in sorted(count_dic.items(), reverse=True):
				if val <= temp_max_gold_medals:
					gold += val
					temp_max_gold_medals -= val
				else:
					temp_max_gold_medals = 0
					if silver <= gold:
						silver += val
					else:
						bronze += val
			max_gold_medals -= 1
		if gold <= 0:
			print('0 0 0')
		else:
			print(gold, silver, bronze)


def make(l):
	from collections import defaultdict
	import math
	dic = defaultdict(int)
	n = len(l)
	for i in range(n):
		dic[l[i]] += 1
	a = list(set(l))
	a.sort()
	limit = math.ceil(n / 2)
	(count, i) = (0, 0)
	while count < limit:
		count += dic[a[i]]
		i += 1
	i = i - 1
	left = i
	ans = []
	gold = dic[a[-1]]
	silver = 0
	i = len(a) - 2
	while silver <= gold and i > left:
		silver += dic[a[i]]
		i -= 1
	bronze = 0
	while bronze <= gold and i > left:
		bronze += dic[a[i]]
		i -= 1
	while bronze < n // 2 - silver - gold and i > left:
		bronze += dic[a[i]]
		i -= 1
	count = 0
	ans = [gold, silver, bronze]
	for i in range(3):
		if ans[i] == 0:
			count += 1
	if count > 0:
		return [0, 0, 0]
	if silver <= gold:
		return [0, 0, 0]
	if bronze <= gold:
		return [0, 0, 0]
	return [gold, silver, bronze]
t = int(input())
import sys
for _ in range(t):
	n = int(sys.stdin.readline())
	l = list(map(int, sys.stdin.readline().split()))
	print(*make(l))


R = lambda : map(int, input().split())
for _ in range(int(input())):
	n = int(input())
	arr = list(R())
	cnt = 1
	cnts = []
	for i in range(1, n):
		if arr[i] == arr[i - 1]:
			cnt += 1
		elif i - 1 < n // 2:
			cnts.append(cnt)
			cnt = 1
	if len(cnts) < 3:
		print(0, 0, 0)
	else:
		l = len(cnts) - 1
		bcnt = 0
		while l > 0 and bcnt <= cnts[0]:
			bcnt += cnts[l]
			l -= 1
		scnt = sum(cnts) - bcnt - cnts[0]
		if bcnt > cnts[0] and scnt > cnts[0]:
			print(cnts[0], scnt, bcnt)
		else:
			print(0, 0, 0)


from collections import defaultdict
t = int(input())
for _ in range(t):
	n = int(input())
	aa = list(map(int, input().split()))
	d = defaultdict(int)
	for i in aa:
		d[i] += 1
	a = []
	for i in d:
		a.append((i, d[i]))
	a = sorted(a, reverse=True)
	if len(a) < 3:
		print(0, 0, 0)
	else:
		(g, s, b) = (0, 0, 0)
		cnt = 0
		c = 0
		while cnt <= n // 2:
			cnt += a[c][1]
			if cnt <= n // 2:
				c += 1
			else:
				cnt -= a[c][1]
				c -= 1
				break
		if c == len(a) or c == -1:
			print(0, 0, 0)
		else:
			if cnt > n // 2:
				cnt -= a[c][1]
				c -= 1
			if c < 2:
				print(0, 0, 0)
			else:
				i = 1
				g = a[0][1]
				s = 0
				while i <= c and s <= g:
					s += a[i][1]
					i += 1
				b = 0
				if i == c + 1:
					print(0, 0, 0)
				else:
					while i <= c:
						b += a[i][1]
						i += 1
					if b <= g or s <= g:
						print(0, 0, 0)
					else:
						print(g, s, b)


import sys
input = sys.stdin.readline
for t in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	if n < 8:
		print(0, 0, 0)
		continue
	b = [0]
	for i in range(1, n):
		if a[i] != a[i - 1]:
			b.append(b[i - 1] + 1)
		else:
			b.append(b[i - 1])
	k = n // 2 - 1
	if b[k] == b[k + 1]:
		while k > 0 and b[k] == b[k + 1]:
			k -= 1
	if k < 4:
		print(0, 0, 0)
		continue
	p = 0
	while p <= k and a[p] == a[p + 1]:
		p += 1
	p += 1
	q = p
	while q <= k:
		if p <= q - p and a[q] != a[q + 1]:
			break
		q += 1
	q += 1
	k += 1
	q = q - p
	k = k - p - q
	if p < q and p < k:
		print(p, q, k)
	else:
		print(0, 0, 0)


from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	n = int(input())
	p = list(map(int, input().split()))
	(l, cou, x) = (p[0], 1, [])
	for i in range(1, n // 2 + 1):
		if l != p[i]:
			l = p[i]
			x.append(cou)
			cou = 0
		cou += 1
	if len(x) < 3:
		print(0, 0, 0)
	else:
		(a, b, c, fl) = (x[0], 0, 0, 0)
		for j in range(1, len(x)):
			if not fl:
				b += x[j]
			else:
				c += x[j]
			if b > a:
				fl = 1
		if a < b and a < c:
			print(a, b, c)
		else:
			print(0, 0, 0)


n = int(input())
for _ in range(n):
	k = int(input())
	arr = list(map(int, input().split(' ')))
	same_num = []
	cnt = 0
	for i in range(k):
		if i == 0 or arr[i] == arr[i - 1]:
			cnt += 1
			if i == k - 1:
				same_num.append(cnt)
		else:
			same_num.append(cnt)
			cnt = 1
	g = same_num[0]
	(s, b) = (0, 0)
	pref_sum = 0
	for i in range(1, len(same_num)):
		pref_sum += same_num[i]
		if pref_sum > g and s == 0:
			s = pref_sum
			pref_sum = 0
		elif pref_sum > g and 2 * (g + s + pref_sum) <= k:
			b = pref_sum
	if b != 0:
		print(g, s, b)
	else:
		print('0 0 0')


for _ in range(int(input())):
	n = int(input())
	a = input().split()
	d = {}
	for i in a:
		if int(i) not in d.keys():
			d[int(i)] = 1
		else:
			d[int(i)] += 1
	l = list(d.keys())
	l.sort(reverse=True)
	s = set()
	c = 0
	i = 0
	while i < len(l):
		c += d[l[i]]
		if c > n // 2:
			c -= d[l[i]]
			break
		else:
			s.add(l[i])
			i += 1
	l = list(s)
	l.sort(reverse=True)
	g = s = b = 0
	if len(l):
		g = d[l[0]]
	i = 1
	while i < len(l):
		if s <= g:
			s += d[l[i]]
			i += 1
		else:
			b += d[l[i]]
			i += 1
	if g < s and g < b:
		print(g, s, b)
	else:
		print('0 0 0')


t = int(input())
for _ in range(t):
	n = int(input())
	s = [int(x) for x in input().split()]
	ps = s[len(s) // 2:]
	s = s[:len(s) // 2]
	if len(s) == 0:
		print(0, 0, 0)
	else:
		L = []
		uni = []
		c = 1
		for i in range(1, len(s)):
			if s[i] != s[i - 1]:
				L.append((s[i - 1], c))
				uni.append(s[i - 1])
				c = 1
			else:
				c += 1
		L.append((s[-1], c))
		uni.append(s[-1])
		if uni[-1] == ps[0]:
			uni = uni[:len(uni) - 1]
			L = L[:len(L) - 1]
		if len(L) == 0:
			print(0, 0, 0)
		else:
			ct = [y for (x, y) in L]
			pre = [ct[0]]
			for i in range(1, len(ct)):
				pre.append(pre[-1] + ct[i])
			gi = -1
			sl = -1
			for i in range(0, len(ct)):
				c1 = pre[i]
				trg = 2 * c1 + 1
				low = i + 1
				high = len(pre) - 1
				temp1 = -1
				while low <= high:
					mid = low + high >> 1
					if pre[mid] >= trg:
						temp1 = mid
						high = mid - 1
					else:
						low = mid + 1
				if temp1 != -1:
					low = temp1 + 1
					high = len(pre) - 1
					trg = pre[temp1] + pre[i] + 1
					temp2 = -1
					while low <= high:
						mid = low + high >> 1
						if pre[mid] >= trg:
							temp2 = mid
							high = mid - 1
						else:
							low = mid + 1
					if temp2 != -1:
						sl = pre[temp1] - pre[i]
						gi = max(gi, i)
					else:
						break
				else:
					break
			if gi == -1:
				print(0, 0, 0)
			else:
				g = pre[gi]
				br = pre[-1] - sl - g
				print(g, sl, br)


def solve():
	n = int(input())
	g = s = b = 0
	arr = [int(a) for a in input().split(' ')]
	sum = {}
	for a in arr:
		sum[a] = sum.get(a, 0) + 1
	vals = list(sum.values())
	half = n // 2
	if n < 3:
		return '0 0 0'
	g = vals[0]
	if g + s + b > half:
		return '0 0 0'
	for i in range(1, len(vals)):
		if g + s + b + vals[i] <= half:
			if g >= s:
				s += vals[i]
			else:
				b += vals[i]
		else:
			break
	if g >= s or g >= b:
		return '0 0 0'
	return f'{g} {s} {b}'
t = int(input())
for i in range(t):
	print(solve())


import sys
input = lambda : sys.stdin.readline().strip('\r\n')
for _ in range(int(input())):
	n = int(input())
	p = list(map(int, input().split()))
	g = 1
	while g < n and p[g] == p[g - 1]:
		g += 1
	s = g + 1
	while g + s < n and p[g + s] == p[g + s - 1]:
		s += 1
	ind = n // 2
	while ind > 0 and p[ind] == p[ind - 1]:
		ind -= 1
	b = ind - s - g
	if b > g:
		print(g, s, b)
	else:
		print(0, 0, 0)


t = int(input())
for t_i in range(t):
	n = int(input())
	P = input().split()
	P = [int(k) for k in P]
	mxm = n // 2
	i = 1
	while i < mxm and P[i] == P[i - 1]:
		i += 1
	n_g = i
	i += n_g + 1
	while i < mxm and P[i] == P[i - 1]:
		i += 1
	n_s = i - n_g
	i += n_g + 1
	n_b = -1
	while i <= mxm:
		if P[i] != P[i - 1]:
			n_b = i - n_g - n_s
		i += 1
	if n_b == -1:
		print('0 0 0')
	else:
		print(' '.join([str(n_g), str(n_s), str(n_b)]))


import sys, os, io

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

def ria():
	return list(map(int, sys.stdin.readline().split()))

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math, datetime, functools, itertools, operator, bisect, fractions, statistics
from collections import deque, defaultdict, OrderedDict, Counter
from fractions import Fraction
from decimal import Decimal
from sys import stdout

def main():
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	for _ in range(ri()):
		n = ri()
		a = ria()
		g = 1
		c = 0
		for i in range(1, n):
			if a[i] < a[i - 1]:
				c = 1
				break
			else:
				g += 1
		if c == 1:
			s = 1
			p = 0
			for j in range(i + 1, n):
				if a[j] < a[j - 1] and s > g:
					p = 1
					break
				else:
					s += 1
			k = n // 2
			b = k - g - s
			for h in range(g + s + b - 1, -1, -1):
				if a[h] == a[h + 1]:
					b -= 1
					continue
				else:
					break
			if b > 0 and g < s and (g < b):
				print(g, s, b)
			else:
				print(0, 0, 0)
		else:
			print(0, 0, 0)
	endtime = datetime.datetime.now()
	time = (endtime - starttime).total_seconds() * 1000
	if os.path.exists('input.txt'):
		print('Time:', time, 'ms')

class FastReader(io.IOBase):
	newlines = 0

	def __init__(self, fd, chunk_size=1024 * 8):
		self._fd = fd
		self._chunk_size = chunk_size
		self.buffer = io.BytesIO()

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self, size=-1):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

class FastWriter(io.IOBase):

	def __init__(self, fd):
		self._fd = fd
		self.buffer = io.BytesIO()
		self.write = self.buffer.write

	def flush(self):
		os.write(self._fd, self.buffer.getvalue())
		(self.buffer.truncate(0), self.buffer.seek(0))

class FastStdin(io.IOBase):

	def __init__(self, fd=0):
		self.buffer = FastReader(fd)
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

class FastStdout(io.IOBase):

	def __init__(self, fd=1):
		self.buffer = FastWriter(fd)
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.flush = self.buffer.flush
sys.stdin = FastStdin()
sys.stdout = FastStdout()
main()


from collections import OrderedDict
n = int(input())
for x in range(n):
	a = int(input())
	array = list(map(int, input().split()))
	limit = int(a // 2)
	vie = 5
	unique = len(set(array[0:limit]))
	if len(array) == 1:
		print(0, 0, 0)
	elif unique < 3:
		print(0, 0, 0)
	else:
		if array[limit - 1] == array[limit]:
			array = array[0:limit]
			target = array[limit - 1]
			while 6 == 6:
				if array[-1] == target:
					array.pop()
				else:
					break
			unique = len(set(array[0:limit]))
		else:
			unique = len(set(array[0:limit]))
			array = array[0:limit]
		dic = OrderedDict()
		count = 1
		flag = 5
		for x in range(len(array) - 1):
			if array[x] == array[x + 1]:
				count += 1
				flag = 5
			else:
				dic[array[x]] = count
				count = 1
				flag = 6
		if flag == 5:
			dic[array[-1]] = count
		else:
			dic[array[-1]] = 1
		flag = 5
		bronze = 0
		silver = 0
		for it in dic:
			if flag == 5:
				gold = dic[it]
				flag = 6
			elif flag == 6:
				silver += dic[it]
				if silver > gold:
					flag = 7
			elif flag == 7:
				bronze += dic[it]
			else:
				pass
		if gold >= silver or gold >= bronze:
			print(0, 0, 0)
		else:
			print(gold, silver, bronze)


from collections import defaultdict as dd
import sys
input = sys.stdin.readline
t = int(input())
while t:
	n = int(input())
	d = dd(int)
	l = list(map(int, input().split()))
	mi = n // 2
	for i in l:
		d[i] += 1
	l = set(l)
	l = list(l)
	l.sort(reverse=True)
	(g, s, b) = (0, 0, 0)
	g = d[l[0]]
	n = len(l)
	ind = 0
	for i in range(1, n):
		s = s + d[l[i]]
		if s > g:
			ind = i + 1
			break
	if ind < n:
		b = d[l[ind]]
		ind += 1
	su = g + s + b
	while ind < n and d[l[ind]] + su <= mi:
		b += d[l[ind]]
		su += d[l[ind]]
		ind += 1
	if g < s and g < b and (g != 0) and (s != 0) and (b != 0) and (su <= mi):
		print(g, s, b)
	else:
		print(0, 0, 0)
	t -= 1


t = int(input())
for q in range(t):
	n = int(input())
	inp = list(map(int, input().split()))
	i = 0
	line = []
	while i < n:
		count = 1
		while i + 1 < n and inp[i] == inp[i + 1]:
			count += 1
			i += 1
		line.append(count)
		i += 1
	l = 3
	r = n // 2
	cg = line[0]
	cs = 0
	i = 1
	while i < len(line) and cg + cs + line[i] <= n // 2 and (cs <= cg):
		cs += line[i]
		i += 1
	if i < len(line) and cg + cs + line[i] <= n // 2:
		cb = line[i]
		i += 1
	else:
		cb = 0
	while i < len(line) and cg + cs + cb + line[i] <= n // 2:
		cb += line[i]
		i += 1
	if cb > cg:
		print(cg, cs, cb)
	else:
		print(0, 0, 0)


for t in range(int(input())):
	n = int(input())
	tmp = [int(i) for i in input().split()]
	ar = []
	ls = -1
	cnt = 0
	for i in tmp:
		if ls != i:
			ls = i
			ar.append(cnt)
			cnt = 0
		if ls == i:
			cnt += 1
	ar.append(cnt)
	i = 2
	g = ar[1]
	s = 0
	b = 0
	while s <= g and i < len(ar):
		s += ar[i]
		i += 1
	while b <= g and i < len(ar):
		b += ar[i]
		i += 1
	while i < len(ar) and g + s + b + ar[i] <= n / 2:
		b += ar[i]
		i += 1
	if g + s + b <= n / 2 and g < s and (g < b):
		print(g, s, b)
	else:
		print(0, 0, 0)


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	d = Counter(l)
	l = sorted(l)[::-1]
	l1 = l[0:len(l) // 2]
	s = l[len(l) // 2]
	a = len(l1)
	for i in range(len(l1) - 1, -1, -1):
		if l1[i] == s:
			a = i
	l1 = l1[0:a]
	d = Counter(l1)
	if len(d) < 3:
		print(0, 0, 0)
	else:
		g1 = max(l1)
		g = d[g1]
		s = 0
		for i in range(len(l1)):
			if l1[i] != g1:
				s1 = l1[i]
				s += d[s1]
				g1 = l1[i]
			if g < s:
				break
		b = len(l1) - g - s
		if g < b and g < s:
			print(g, s, b)
		else:
			print(0, 0, 0)


def grouper(X):
	v = None
	sz = 0
	for x in X:
		if v != x:
			if not v is None:
				yield sz
			v = x
			sz = 1
		else:
			sz += 1
	if not v is None:
		yield sz
T = int(input())
for t in range(T):
	n = int(input())
	P = map(int, input().split())
	(g, s, b) = (0, 0, 0)
	sz = 0
	for gr in grouper(P):
		sz += gr
		if sz > n // 2:
			break
		if g == 0:
			g = gr
		elif s <= g:
			s += gr
		else:
			b += gr
	ans = (0, 0, 0)
	if 0 < g < s and g < b:
		ans = (g, s, b)
	print(' '.join(map(str, ans)))


n = int(input())
while n > 0:
	q = int(input())
	x = list(map(lambda x: int(x), input().split(' ')))
	cnt = int(q / 2)
	while cnt > 0 and x[cnt - 1] == x[cnt]:
		cnt -= 1
	if cnt == 0:
		print(0, 0, 0)
		n -= 1
		continue
	g = 1
	while g < cnt and x[g - 1] == x[g]:
		g += 1
	s = g + 1
	while g + s < cnt and x[g + s - 1] == x[g + s]:
		s += 1
	b = cnt - g - s
	if b > g:
		print(g, s, b)
	else:
		print(0, 0, 0)
	n -= 1


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	d = {}
	for i in l:
		if i in d:
			d[i] += 1
		else:
			d[i] = 1
	flag = 1
	s = sorted(list(set(l)), reverse=True)
	t = len(s)
	su = 0
	h = n // 2
	z = []
	q = 0
	for i in s:
		if su + d[i] <= h:
			z.append(d[i])
			su += d[i]
			q += 1
		else:
			break
	if q >= 3:
		g = z[0]
		si = 0
		b = 0
		for i in range(1, q):
			si += z[i]
			if si > g:
				break
		if i < q:
			b = sum(z[i + 1:])
		else:
			flag = 0
		if g < si and g < b:
			print(g, si, b)
		else:
			flag = 0
	else:
		flag = 0
	if flag == 0:
		print(0, 0, 0)


t = int(input())
for you in range(t):
	n = int(input())
	l = input().split()
	li = [int(i) for i in l]
	g = 0
	s = 0
	b = 0
	i = 0
	while li[i] == li[0]:
		i += 1
		g += 1
		if i == n:
			break
	if g < n:
		i = g
		k = g
		while li[i] == li[k] or s <= g:
			if li[i] != li[k]:
				k = i
			s += 1
			i += 1
			if i == n:
				break
	if g + s < n // 2:
		b = n // 2 - g - s
		while li[g + s + b] == li[g + s + b - 1]:
			b -= 1
			if b == 0:
				break
	if b == 0 or g + s >= n // 2 or b <= g:
		print(0, 0, 0)
	else:
		print(g, s, b)


def main():

	def solve():
		n = int(input())
		pp = [int(a) for a in input().split()]
		nmv = pp[n // 2]
		fp = n // 2 - 1
		while fp >= 4 and pp[fp] == nmv:
			fp -= 1
		if fp < 4:
			print('0 0 0')
			return
		gv = pp[0]
		g = 1
		while pp[g] == gv:
			g += 1
		s = g + 1
		if g + s > fp:
			print('0 0 0')
			return
		sv = pp[g + s - 1]
		while pp[g + s] == sv:
			s += 1
		if 2 * g + s > fp:
			print('0 0 0')
			return
		else:
			b = fp - g - s + 1
		print(g, s, b)
	q = int(input())
	for _ in range(q):
		solve()
main()


import sys

def main():
	from collections import Counter
	for tc in range(int(input())):
		n = int(input())
		arr = get_array()
		x = arr[n // 2]
		arr = arr[:n // 2]
		n = len(arr)
		if n <= 2:
			print(0, 0, 0)
			continue
		(g, s, b) = (0, 0, 0)
		g += 1
		i = 1
		while i < len(arr) and arr[i] == arr[0]:
			i += 1
			g += 1
		j = i
		if i == len(arr):
			print(0, 0, 0)
			continue
		while i < len(arr) and (arr[i] == arr[j] or s <= g):
			j = i
			s += 1
			i += 1
		if i == len(arr):
			print(0, 0, 0)
			continue
		j = i
		p = arr[i]
		while i < len(arr) and (arr[i] > x or arr[i] == arr[j] or b <= g):
			p = arr[i]
			j = i
			b += 1
			i += 1
		if x == p:
			print(0, 0, 0)
			continue
		if g >= b or g >= s:
			print(0, 0, 0)
		else:
			print(g, s, b)
get_array = lambda : list(map(int, sys.stdin.readline().split()))
get_ints = lambda : map(int, sys.stdin.readline().split())
input = lambda : sys.stdin.readline().strip()
main()


from bisect import bisect_right

def find_le(a, x):
	i = bisect_right(a, x)
	return a[i - 1]

def solve(drop_idx):
	if len(drop_idx) < 3:
		return (0, 0, 0)
	g = drop_idx[0]
	b = find_le(drop_idx, n // 2)
	s = -1
	for idx in drop_idx:
		if idx - g > g and b - idx > g:
			s = idx
			break
	if s == -1:
		return (0, 0, 0)
	else:
		return (g, s - g, b - s)
t = int(input())
sol = []
for tc in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	drop_idx = []
	for i in range(n - 1):
		if p[i] > p[i + 1]:
			drop_idx.append(i + 1)
	sol.append(solve(drop_idx))
for s in sol:
	print(*s)


import sys
from itertools import accumulate
from bisect import bisect_left, bisect
readline = sys.stdin.readline
T = int(readline())
Ans = [None] * T
inf = 10 ** 9 + 7
for qu in range(T):
	N = int(readline())
	P = list(map(int, readline().split())) + [None]
	if N < 6:
		Ans[qu] = (0, 0, 0)
		continue
	L = []
	pre = None
	cnt = 0
	for p in P:
		if pre != p:
			L.append(cnt)
			cnt = 1
		else:
			cnt += 1
		pre = p
	L = L[1:]
	AL = list(accumulate(L))
	AL += [inf]
	M = len(L)
	ans = (0, 0, 0)
	aa = 0
	for i in range(M):
		g = AL[i]
		if 3 * g + 2 > N // 2:
			break
		sidx = bisect_left(AL, 2 * g + 1)
		s = AL[sidx]
		if s >= inf:
			continue
		blidx = bisect_left(AL, s + g + 1)
		bridx = bisect(AL, N // 2) - 1
		if blidx > bridx:
			continue
		if aa < AL[bridx]:
			ans = (g, s - g, AL[bridx] - s)
	Ans[qu] = ans
for a in Ans:
	sys.stdout.write('{} {} {}\n'.format(*a))


for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	if n < 10:
		print(0, 0, 0)
		continue
	li = n
	n = n // 2
	(g, s, b) = (0, 0, 0)
	for i in range(len(a) - 1):
		g += 1
		if a[i] != a[i + 1]:
			break
	for i in range(g, n):
		s += 1
		li = i
		if a[i] != a[i + 1] and s > g:
			break
	if a[n] == a[n - 1]:
		for i in range(n - 1, -1, -1):
			if a[i] != a[n]:
				n = i + 1
				break
	for i in range(li + 1, n):
		b += 1
	if g < s and g < b:
		print(g, s, b)
	else:
		print(0, 0, 0)


T = int(input())
for X in range(T):
	N = int(input())
	P = list(map(int, input().split()))
	D = {}
	G = S = B = 0
	A = 0
	for I in range(len(P)):
		if P[I] in D:
			D[P[I]] += 1
		else:
			D[P[I]] = 1
			if 0 < I < N // 2 + 1:
				A += D[P[I - 1]]
				if A > N // 2:
					break
	Z = list(D.keys())
	G = D[Z[0]]
	I = 1
	while S <= G and I < len(Z) - 1:
		S += D[Z[I]]
		I += 1
	B = A - G - S
	if 0 < G < S and G < B:
		print(G, S, B)
	else:
		print(0, 0, 0)


def arr_float_inp():
	return [float(s) for s in input().split()]

def arr_int_inp():
	return [int(s) for s in input().split()]

def int_inp():
	return int(input())

def float_inp():
	return float(input())
for _ in range(int_inp()):
	n = int_inp()
	inp_arr = arr_int_inp()
	arr = {}
	for i in range(n):
		if inp_arr[i] in arr:
			arr[inp_arr[i]] += 1
		else:
			arr[inp_arr[i]] = 1
	try:
		(g, s, b) = (0, 0, 0)
		arr_values = list(arr.values())
		g = arr_values[0]
		id = 1
		while s <= g:
			s += arr_values[id]
			id += 1
		while b <= g or g + s + b + arr_values[id] <= n // 2:
			b += arr_values[id]
			id += 1
	except:
		print('0 0 0')
		continue
	if g + s + b > n // 2:
		print('0 0 0')
	else:
		print(str(g) + ' ' + str(s) + ' ' + str(b))


from sys import stdin, stdout
from math import gcd, sqrt, factorial
from collections import deque, defaultdict
input = stdin.readline
R = lambda : map(int, input().split())
I = lambda : int(input())
S = lambda : input().rstrip('\n')
L = lambda : list(R())
P = lambda x: stdout.write(x)
lcm = lambda x, y: x * y // gcd(x, y)
hg = lambda x, y: (y + x - 1) // x * x
pw = lambda x: 0 if x == 1 else 1 + pw(x // 2)
chk = lambda x: chk(x // 2) if not x % 2 else True if x == 1 else False
sm = lambda x: (x ** 2 + x) // 2
N = 10 ** 9 + 7
for _ in range(I()):
	n = I()
	a = L()
	stp = a[n // 2]
	v = [0] * 3
	pst1 = pst2 = -1
	for i in a:
		if i == stp:
			break
		if not v[0] or pst1 == i:
			v[0] += 1
			pst1 = i
		elif v[1] <= v[0] or pst2 == i:
			v[1] += 1
			pst2 = i
		else:
			v[2] += 1
	if 0 not in v and v[0] < v[1] and (v[0] < v[2]):
		print(*v)
	else:
		print(0, 0, 0)


for _ in range(int(input())):
	n = int(input())
	points = list(map(int, input().split()))
	count = []
	prev = -1
	for i in range(n):
		if points[i] == prev:
			count[-1] += 1
		else:
			count.append(1)
		prev = points[i]
	m = 0
	tot = 0
	while tot + count[m] <= n // 2:
		tot += count[m]
		m += 1
	fail = False
	(gold, silv, bron) = (0, 0, 0)
	if m < 3:
		fail = True
	else:
		gold = count[0]
		silv = count[1]
		j = 1
		while gold >= silv and j + 1 < m:
			j += 1
			silv += count[j]
		bron = sum(count[j + 1:m])
		if gold >= silv or gold >= bron:
			fail = True
	if fail:
		print('0 0 0')
	else:
		print(gold, silv, bron)


import sys
reader = (map(int, line.split()) for line in sys.stdin)
input = reader.__next__

def gsb(p, n):
	if n < 10:
		return [0, 0, 0]
	m = n // 2 - 1
	while m >= 0 and p[m] == p[m + 1]:
		m -= 1
	if m < 4:
		return [0, 0, 0]
	g = 1
	while g - 1 < m and p[g - 1] == p[g]:
		g += 1
	if g - 1 == m:
		return [0, 0, 0]
	clusters = []
	k = 1
	for i in range(g, m - 1):
		if p[i] != p[i + 1]:
			clusters.append(k)
			k = 1
		else:
			k += 1
	clusters.append(k)
	s = 0
	for c in clusters:
		s += c
		if s > g:
			break
	b = m + 1 - g - s
	if b > g:
		return [g, s, b]
	else:
		return [0, 0, 0]
(t,) = input()
for _ in range(t):
	(n,) = input()
	p = list(input())
	ans = gsb(p, n)
	print(*ans)


def answer(n, A):
	if n < 10:
		return [0, 0, 0]
	flag = 0
	if A[n // 2 - 1] == A[n // 2]:
		flag = 1
	d = {}
	for i in range(n // 2):
		if flag:
			if A[i] == A[n // 2]:
				break
		if A[i] in d:
			d[A[i]] += 1
		else:
			d[A[i]] = 1
	if len(d) < 3:
		return [0, 0, 0]
	g = 0
	s = 0
	b = 0
	flag = 1
	for i in d:
		if flag:
			g = d[i]
			flag = 0
		elif s <= g:
			s += d[i]
		else:
			b += d[i]
	if g < s and g < b:
		return [g, s, b]
	return [0, 0, 0]
t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	print(*answer(n, arr))


from itertools import groupby
t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(x) for x in input().split()]
	ans = [len(list(g)) for (k, g) in groupby(arr)]
	g = ans[0]
	s = 0
	b = 0
	ind = 1
	while g + s + b <= len(arr) // 2:
		if ind == len(ans):
			break
		if g + s + b + ans[ind] > len(arr) // 2:
			break
		if g >= s:
			s += ans[ind]
		else:
			b += ans[ind]
		ind += 1
	if g < s and g < b:
		print(g, s, b)
	else:
		print(0, 0, 0)


import sys, math

def input():
	return sys.stdin.readline()[:-1]

def main():
	q = int(input())
	for _ in range(q):
		n = int(input())
		p = list(map(int, input().split()))
		now = 0
		g = 0
		f = 0
		for k in range(n):
			if p[k] == p[0]:
				g += 1
			else:
				f = k
				now = p[k]
				break
		if g + g + 1 + g + 1 > n // 2 or n < 10:
			print('0 0 0')
		else:
			s = 0
			now = p[g + g]
			for k in range(f, n):
				if p[k] >= now:
					s += 1
				else:
					now = p[k]
					f = k
					break
			cur = 0
			b = 0
			for k in range(f, n):
				if now == p[k]:
					cur += 1
				elif cur + b + s + g > n // 2:
					break
				else:
					b += cur
					cur = 1
					now = p[k]
			if g < s and g < b and (g * b * s != 0):
				print(g, s, b)
			else:
				print('0 0 0')
main()


from sys import stdin, stdout
read = lambda : map(int, stdin.readline().split())
I = lambda : stdin.readline()
for _ in range(int(I())):
	n = int(I())
	arr = tuple(read())
	n1 = n // 2 - 1
	flag1 = True
	while n1 >= 0 and arr[n1 + 1] == arr[n1]:
		n1 -= 1
	possible = True
	if n1 < 3:
		print('0 0 0')
	else:
		c1 = 1
		i1 = 1
		while arr[i1] == arr[i1 - 1] and i1 <= n1:
			i1 = c1 = i1 + 1
		c2 = 0
		while (arr[i1] == arr[i1 - 1] or c2 <= c1) and i1 <= n1:
			i1 += 1
			c2 += 1
		b = n1 - (c1 + c2) + 1
		if b > c1:
			print(c1, c2, b)
		else:
			print('0 0 0')


n = int(input())
for i in range(n):
	k = int(input())
	g = 0
	s = 0
	b = 0
	gcount = 0
	scount = 0
	bcount = 0
	bb = 0
	m = list(map(int, input().split()))
	for j in range(k):
		if g == 0:
			g += 1
			gcount = m[j]
		elif gcount == m[j]:
			g += 1
		elif s <= g:
			scount = m[j]
			s += 1
		elif scount == m[j]:
			s += 1
		elif b <= g:
			bcount = m[j]
			b += 1
		elif bcount == m[j]:
			b += 1
		else:
			if bcount != m[j]:
				bb = b
				bcount = m[j]
			b += 1
		if (g + s + b) * 2 > k:
			break
	if bb == 0:
		print(0, 0, 0)
	else:
		print(g, s, bb)


for __ in range(int(input())):
	n = int(input())
	arr = [int(s) for s in input().split()]
	g = 1
	while g < n and arr[g - 1] == arr[g]:
		g += 1
	s = g + 1
	while s + g < n and arr[g + s - 1] == arr[g + s]:
		s += 1
	a = n // 2
	while a > 0 and arr[a] == arr[a - 1]:
		a -= 1
	b = a - g - s
	if b > g:
		print(g, s, b)
	else:
		print(0, 0, 0)


import sys
input = sys.stdin.readline
t = int(input())
for i in range(t):
	n = int(input())
	data = [int(i) for i in input().split()]
	for r in range(n // 2 - 1, 0, -1):
		if data[r] != data[r + 1] and data[r] != data[n // 2]:
			break
	else:
		print('0 0 0')
		continue
	for g in range(1, r + 1):
		if data[g] != data[g - 1]:
			break
	else:
		print('0 0 0')
		continue
	for s_idx in range(2 * g, r + 1):
		if data[s_idx + 1] != data[s_idx]:
			break
	else:
		print('0 0 0')
		continue
	for b_idx in range(r - g, g - 1, -1):
		if data[b_idx] != data[b_idx - 1]:
			break
	else:
		print('0 0 0')
		continue
	k = r + 1
	s_min = s_idx + 1 - g
	b_min = r - b_idx + 1
	if k - s_min - g > g:
		print(str(g) + ' ' + str(s_min) + ' ' + str(k - s_min - g))
	elif k - b_min - g > g:
		print(str(g) + ' ' + str(k - b_min - g) + ' ' + str(b_min))
	else:
		print('0 0 0')


t = int(input())
for _ in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	if n < 10:
		print(0, 0, 0)
		continue
	temp = []
	d = dict()
	for i in range(n):
		if i == 0:
			temp.append(p[i])
			d[p[i]] = 1
		elif p[i] == temp[-1]:
			d[p[i]] += 1
		else:
			temp.append(p[i])
			d[p[i]] = 1
	lol = len(temp)
	i = 0
	cg = d[temp[i]]
	cs = 0
	i += 1
	while cs <= cg and i < lol:
		cs += d[temp[i]]
		i += 1
	cb = 0
	tot1 = 0
	tot = cg + cs
	while i < lol:
		tot1 = d[temp[i]]
		i += 1
		if tot + tot1 > n // 2:
			break
		else:
			tot = tot + tot1
			cb += tot1
	if cg < cs and cg < cb:
		print(cg, cs, cb)
	else:
		print(0, 0, 0)


t = int(input())
for i in range(t):
	n = int(input())
	s = list(map(int, input().split()))
	if n // 2 < 3:
		print('0 0 0')
		continue
	dict = {}
	l = []
	flag = -1
	if s[n // 2 - 1] == s[n // 2]:
		flag = s[n // 2]
	for j in range(n // 2):
		if s[j] != flag:
			if dict.get(s[j]) == None:
				dict[s[j]] = 0
				l.append(s[j])
			dict[s[j]] += 1
	total = 0
	for j in range(len(l)):
		total += dict[l[j]]
	if len(l) < 3:
		print('0 0 0')
		continue
	g = dict[l[0]]
	s = 0
	b = 0
	for j in range(1, len(l)):
		if s <= g:
			s += dict[l[j]]
		else:
			break
	b = total - g - s
	if g >= s or g >= b:
		print('0 0 0')
		continue
	print(g, s, b)


for _ in [0] * int(input()):
	n = int(input())
	a = ['0'] * 3
	s = list(map(int, input().split()))
	if n >= 5:
		i = j = m = 0
		for x in range(1, n):
			if not s[x] == s[x - 1]:
				if i == 0:
					i = x
					if i > int(n / 3):
						break
				elif j == 0:
					if x > i * 2:
						j = x - i
				elif x <= n / 2 and x - j - i > i:
					m = x - j - i
					a = [str(i), str(j), str(m)]
				elif x > n / 2:
					break
	print(' '.join(a))


lpn = int(input())
for loop in range(lpn):
	N = int(input())
	p = list(map(int, input().split()))
	lis = [1]
	for i in range(N - 1):
		i += 1
		if p[i - 1] == p[i]:
			lis[-1] += 1
		else:
			lis.append(1)
	g = lis[0]
	s = 0
	b = 0
	slf = 0
	for i in range(len(lis) - 1):
		i += 1
		if slf == 0:
			s += lis[i]
			if s > g:
				slf = 1
		elif slf == 1:
			if g + s + b + lis[i] <= N // 2:
				b += lis[i]
			else:
				break
	if g < s and g < b and (g + s + b <= N // 2):
		print(g, s, b)
	else:
		print(0, 0, 0)


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(v) for v in input().split()]
	p = n // 2
	c = 1
	b = []
	f = 0
	for j in range(1, p):
		if a[j] == a[j - 1]:
			c = c + 1
		else:
			b.append(c)
			c = 1
	b.append(c)
	if a[p - 1] == a[p]:
		del b[-1]
	if len(b) < 3:
		f = 1
	else:
		p = b[0]
		j = 1
		q = 0
		while j < len(b) and q <= p:
			q = q + b[j]
			j = j + 1
		if q <= p:
			f = 1
		else:
			r = 0
			while j < len(b):
				r = r + b[j]
				j = j + 1
			if r <= p:
				f = 1
	if f == 1:
		print('0 0 0')
	else:
		print(p, q, r)


import math
import os
import sys
input = lambda : sys.stdin.readline().strip('\r\n')

def cin():
	return sys.stdin.readline().strip('\r\n')

def fora():
	return list(map(int, sys.stdin.readline().strip().split()))

def string():
	return sys.stdin.readline().strip()

def cout(ans):
	sys.stdout.write(str(ans))

def endl():
	sys.stdout.write(str('\n'))

def ende():
	sys.stdout.write(str(' '))

def main():
	for _ in range(int(input())):
		n = int(cin())
		l = fora()
		if n // 2 > 3:
			mp = {}
			mp = dict.fromkeys(l, 0)
			for i in l:
				mp[i] += 1
			cnt = g = s = b = 0
			flag = j = 1
			for i in mp:
				if j == 1:
					g += mp[i]
					cnt += mp[i]
				elif flag:
					s += mp[i]
					cnt += mp[i]
					if s > g:
						flag = 0
				else:
					if cnt >= n // 2:
						break
					b += mp[i]
					cnt += mp[i]
					if cnt > n // 2:
						b -= mp[i]
						break
				j += 1
			if g == 0 or s == 0 or b == 0:
				print('0 ' * 3, end='')
			elif g >= s or g >= b:
				print('0 ' * 3, end='')
			else:
				cout(g)
				ende()
				cout(s)
				ende()
				cout(b)
		else:
			print('0 ' * 3, end='')
		endl()
main()


def solve():
	n = int(input())
	(a, lim) = (list(map(int, input().split(' '))), n // 2)
	(wt, vt) = ([], [])
	pt = -1
	for v in a:
		if v != pt:
			pt = v
			wt.append(0)
			vt.append(v)
		wt[-1] += 1
	(g, s, b) = (wt[0], 0, 0)
	c = 1
	while s <= g and s < lim - g and (c < len(wt)):
		s += wt[c]
		c += 1
	while b <= lim - s - g and c < len(wt):
		b += wt[c]
		c += 1
	b -= wt[c - 1]
	if min(g, s, b) <= 0 or g >= s or g >= b:
		print(0, 0, 0)
	else:
		print(g, s, b)
n = int(input())
for i in range(n):
	solve()


t = int(input())
for i in range(t):
	n = int(input())
	p = [int(x) for x in input().split()]
	if len(set(p)) < 4 or n < 6:
		print('0 0 0')
	else:
		n = n // 2
		cut = p[n]
		p = p[:n]
		p = p[:len(p) - p.count(cut)]
		g = 0
		s = 0
		b = 0
		possible = True
		psize = len(p)
		if len(set(p)) > 2:
			goldcut = p[0]
			j = 0
			while p[j] == goldcut:
				g += 1
				j += 1
				if j >= psize:
					possible = False
					break
			while s <= g:
				if j >= psize:
					possible = False
					break
				silvercut = p[j]
				while p[j] == silvercut:
					s += 1
					j += 1
					if j >= psize:
						possible = False
						break
			b = psize - j
		else:
			possible = False
		if b <= g:
			print('0 0 0')
		else:
			print(g, end=' ')
			print(s, end=' ')
			print(b)


for _ in range(int(input())):
	n = int(input())
	l = [int(s) for s in input().split()]
	if len(set(l)) < 3:
		print(0, 0, 0)
		continue
	i = n // 2 - 1
	if l[n // 2 - 1] == l[n // 2]:
		while i >= 0 and l[i] == l[n // 2]:
			i -= 1
		if i < 0:
			print(0, 0, 0)
			continue
	l = l[:i + 1]
	if len(set(l)) < 3:
		print(0, 0, 0)
		continue
	i = 1
	while l[i] == l[0]:
		i += 1
	g = i
	s = 0
	flag = 0
	while s <= g:
		j = i
		if j == len(l):
			flag = 1
			break
		while i < len(l) and l[i] == l[j]:
			i += 1
		s = i - g
	if flag:
		print(0, 0, 0)
		continue
	b = len(l) - g - s
	if g >= b or g >= s:
		print(0, 0, 0)
		continue
	print(g, s, b)


MOD = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
for _ in range(ii()):
	n = ii()
	l = il()
	d = dict()
	for i in l:
		if not i in d:
			d[i] = 1
		else:
			d[i] += 1
	lsrt = sorted(list(set(l)), reverse=True)
	g = s = b = 0
	cnt = 0
	for i in lsrt:
		if cnt + d[i] > n // 2:
			break
		if g == 0:
			g += d[i]
		elif s <= g:
			s += d[i]
		else:
			b += d[i]
		cnt += d[i]
	if g < s and g < b:
		print(g, s, b)
	else:
		print(0, 0, 0)


import os
import sys
from io import BytesIO, IOBase
import heapq as h
from types import GeneratorType
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			self.os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import time
start_time = time.time()
import collections as col
import math
from functools import reduce

def getInts():
	return [int(s) for s in input().split()]

def getInt():
	return int(input())

def getStrs():
	return [s for s in input().split()]

def getStr():
	return input()

def listStr():
	return list(input())

def solve():
	N = getInt()
	P = getInts()
	if N < 10:
		print(0, 0, 0)
		return
	max_not_poss = P[N // 2]
	P = P[:N // 2]
	while P and P[-1] == max_not_poss:
		P.pop()
	if len(set(P)) < 3:
		print(0, 0, 0)
		return
	P.reverse()
	(G, G_val) = (0, P[-1])
	while P and P[-1] == G_val:
		G += 1
		P.pop()
	if len(P) <= 2 * G + 1:
		print(0, 0, 0)
		return
	S = 0
	while S <= G:
		next_val = P.pop()
		S += 1
	while P and P[-1] == next_val:
		S += 1
		P.pop()
	B = len(P)
	if B > G:
		print(G, S, B)
		return
	print(0, 0, 0)
	return
for _ in range(getInt()):
	solve()


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	val = l[0]
	g = 0
	for i in range(n):
		if l[i] == val:
			g += 1
		else:
			val = l[i]
			break
	if g > n // 2:
		print(0, 0, 0)
	else:
		b = 0
		c = 0
		for i in range(n):
			if l[i] == val:
				c += 1
			elif l[i] < val:
				b += c
				if b > g:
					val = l[i]
					break
				else:
					val = l[i]
					c = 1
		if g + b > n // 2:
			print(0, 0, 0)
		else:
			c = 0
			q = 0
			for i in range(n):
				if l[i] == val:
					q += 1
				elif l[i] < val:
					val = l[i]
					c += q
					if g + b + c <= n // 2:
						q = 1
					else:
						c = c - q
						break
			if c > g:
				print(g, b, c)
			else:
				print(0, 0, 0)


t = int(input())
for _ in range(t):
	n = int(input())
	p = [int(x) for x in input().split()]
	if n < 6:
		print('0 0 0')
		continue
	anchor = n // 2
	x = p[anchor]
	for i in range(anchor - 1, 0, -1):
		if p[i] != x:
			anchor = i
			break
	prev = 1
	medals = [1, 0, 0]
	for i in range(1, anchor + 1):
		if p[i] == p[i - 1]:
			medals[prev - 1] += 1
		elif prev == 1:
			prev = 2
			medals[1] += 1
		elif prev == 2 and medals[0] >= medals[1]:
			prev = 2
			medals[1] += 1
		elif prev == 2 and medals[0] < medals[1]:
			prev = 3
			medals[2] += 1
		elif prev == 3:
			medals[2] += 1
	if medals[0] < 1 or medals[1] < 1 or medals[2] < 1:
		print('0 0 0')
		continue
	if medals[0] >= medals[2]:
		print('0 0 0')
		continue
	print(medals[0], medals[1], medals[2])


import sys
input = sys.stdin.buffer.readline
T = int(input())
for _ in range(T):
	N = int(input())
	p = list(map(int, input().split()))
	ok = 1
	p_upper = p[:N // 2]
	border = p[N // 2]
	while p_upper:
		if p_upper[-1] == border:
			p_upper.pop()
		else:
			break
	if not p_upper:
		print(0, 0, 0)
		continue
	g_score = p_upper[0]
	g = 0
	i = 0
	while True:
		if i == len(p_upper):
			print(0, 0, 0)
			ok = 0
			break
		if p_upper[i] == g_score:
			g += 1
			i += 1
		else:
			break
	if not ok:
		continue
	s = 0
	s_score = p_upper[i]
	while True:
		if i == len(p_upper):
			print(0, 0, 0)
			ok = 0
			break
		if p_upper[i] == s_score:
			s += 1
			i += 1
		elif s > g:
			break
		else:
			s_score = p_upper[i]
	if not ok:
		continue
	b = len(p_upper) - g - s
	if g >= b:
		print(0, 0, 0)
	else:
		print(g, s, b)


import os
import sys
from math import *
from collections import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
ALPHA = 'abcdefghijklmnopqrstuvwxyz'
M = 10 ** 9 + 7
EPS = 1e-06

def Ceil(a, b):
	return a // b + int(a % b > 0)

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
for _ in range(Int()):
	n = Int()
	a = array()
	key = a[n // 2]
	a = a[:n // 2]
	while len(a) > 0 and a[-1] == key:
		a.pop()
	C = Counter(a)
	C = [C[i] for i in C]
	if len(C) < 3:
		print(0, 0, 0)
	else:
		g = C[0]
		s = 0
		b = sum(C) - g
		i = 1
		while i < len(C) and s <= g:
			s += C[i]
			b -= C[i]
			i += 1
		if b <= g:
			print(0, 0, 0)
		else:
			print(g, s, b)


for _ in range(int(input())):
	n = int(input())
	p = list(map(int, input().split()))
	n_max = n // 2
	max_g = n // 6
	(g, s, b) = (0, 0, 0)
	L = []
	if n >= 10:
		if p[n_max - 1] == p[n_max]:
			i = n_max - 1
			while p[i] == p[i + 1] and i > 0:
				i = i - 1
			n_max = i + 1
		if n_max > 4:
			count = 1
			for i in range(n_max):
				if p[i] == p[i + 1]:
					count += 1
				else:
					L.append(count)
					count = 1
			k = 0
			g = g + L[k]
			k += 1
			if g <= max_g:
				while k < len(L) and s <= g:
					s = s + L[k]
					k += 1
				while k < len(L):
					b += L[k]
					k += 1
			if s <= g or b <= g or g == 0 or (s == 0) or (b == 0):
				(g, s, b) = (0, 0, 0)
	print(g, s, b)


from collections import Counter
for _ in range(int(input())):
	leng = int(input())
	c = [int(x) for x in input().split()]
	d = Counter(c)
	z = sorted(d.items(), reverse=True)
	if len(z) < 3:
		print('0 0 0')
		continue
	g = 0
	cG = z[0][1]
	s = 1
	cS = z[1][1]
	b = 2
	cB = z[2][1]
	totDif = len(z)
	imp = False
	while cG >= cS:
		s += 1
		if b + 1 >= totDif:
			imp = True
			break
		b += 1
		cS += z[s][1]
		cB -= z[s][1]
		cB += z[b][1]
	if imp == True:
		print('0 0 0')
		continue
	while cG >= cB:
		if b + 1 >= totDif:
			imp = True
			break
		b += 1
		cB += z[b][1]
	if imp == True:
		print('0 0 0')
		continue
	if cG + cS + cB > int(leng / 2):
		print('0 0 0')
		continue
	act = cG + cS + cB
	varr = int(leng / 2)
	while True:
		if b + 1 >= totDif:
			break
		b += 1
		if act + z[b][1] <= varr:
			cB += z[b][1]
			act += z[b][1]
		else:
			break
	print(str(cG) + ' ' + str(cS) + ' ' + str(cB))
	continue


from sys import stdin

def input():
	return stdin.buffer.readline()
t = int(input())
for _ in range(t):
	n = int(input())
	txt = list(map(int, input().split()))
	mmax = txt[0]
	c = 0
	mi = 0
	m = [0, 0, 0]
	for i in range(0, n // 2):
		if txt[i] == mmax:
			c += 1
		else:
			mmax = txt[i]
			m[mi] += c
			c = 1
			if m[mi] > m[0] and mi == 1 or mi == 0:
				mi += 1
	if txt[n // 2] != txt[n // 2 - 1]:
		m[2] += c
	for i in range(len(m)):
		if m[i] == 0:
			m = [0, 0, 0]
	if m[2] <= m[0] or m[1] <= m[0]:
		m = [0, 0, 0]
	for i in range(len(m)):
		print(m[i], end=' ')
	print()


from sys import stdin, stdout
cases = int(stdin.readline().strip())
for caso in range(cases):
	n = int(stdin.readline().strip())
	s = list(map(int, stdin.readline().strip().split()))
	mid = n // 2
	g = -1
	s1 = -1
	b = -1
	for i in range(1, n):
		if s[i] != s[i - 1]:
			g = i
			break
	lim = max(1, g)
	for i in range(lim, n):
		if s[i] != s[i - 1] and i > 2 * lim:
			s1 = i - lim
			lim = i
			break
	lim = max(3, lim)
	for i in range(lim, mid + 1):
		if s[i] != s[i - 1] and i - g - s1 > g:
			b = i - g - s1
	if g == -1 or s1 == -1 or b == -1:
		stdout.write('0 0 0\n')
	else:
		stdout.write('%d %d %d\n' % (g, s1, b))


import sys
input = sys.stdin.buffer.readline
from collections import defaultdict
import bisect

def getlist():
	return list(map(int, input().split()))

def main():
	Q = int(input())
	for i in range(Q):
		N = int(input())
		A = getlist()
		B = [0]
		v = A[0]
		c = 0
		for j in range(N):
			if A[j] == v:
				c += 1
			else:
				B.append(c)
				c += 1
			v = A[j]
		B.append(c)
		g = B[1]
		s = 0
		b = 0
		x = bisect.bisect_left(B, int(N // 2))
		if B[x] > int(N // 2):
			x -= 1
		total = B[x]
		judge = 'No'
		for j in range(2, x + 1):
			X = B[j]
			if X > 2 * g and total - X > g:
				s = X - g
				b = total - X
				judge = 'Yes'
				break
		if judge == 'No':
			print(0, 0, 0)
		else:
			print(g, s, b)
main()


t = int(input())
for tt in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort(reverse=True)
	cc = 0
	g = 1
	check = arr[0]
	index = 0
	for i in range(1, n // 2):
		if check == arr[i]:
			g += 1
		else:
			index = i
			break
	s = 0
	lol = index
	check = arr[index]
	for i in range(index, n // 2):
		if check == arr[i]:
			s += 1
		elif g >= s:
			s += 1
			check = arr[i]
		else:
			lol = i
			break
	b = n // 2 - (s + g)
	lol = arr[n // 2]
	i = n // 2 - 1
	while i >= 0 and b > 0:
		if lol == arr[i]:
			i -= 1
			b -= 1
		else:
			break
	if g >= s or g >= b:
		print('0 0 0')
		continue
	if b <= 0 or s <= 0 or g <= 0:
		print('0 0 0')
	else:
		print(g, s, b)


from itertools import groupby
t = int(input())
for _ in range(0, t):
	n = int(input())
	lst = [int(i) for i in input().split()]
	ans = [len(list(g)) for (k, g) in groupby(lst)]
	ff = []
	ss = 0
	r = n // 2
	bb = -1
	for i in range(0, len(ans)):
		if ss + ans[i] <= r:
			ss += ans[i]
		else:
			bb = i
			break
	g = ans[0]
	(s, b) = (0, 0)
	for i in range(1, bb):
		if s <= g:
			s += ans[i]
		else:
			b += ans[i]
	if g + s + b <= r and g < s and (g < b):
		print(g, s, b)
	else:
		print(0, 0, 0)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	if n < 10:
		print(0, 0, 0)
		continue
	a.sort(reverse=True)
	g = 0
	s = 0
	b = 0
	mx = max(a)
	for i in range(n // 2):
		if a[i] == mx:
			g += 1
		elif g > s:
			s += 1
		elif g < s and a[i] != t:
			b += 1
		elif g == s and s != 0:
			t = a[i]
			s += 1
		elif g < s and a[i] == t:
			s += 1
	if a[n // 2] == a[n // 2 - 1]:
		h = a[:n // 2].count(a[n // 2])
		b -= h
	if b <= g or s <= g or min(b, g, s) == 0:
		print(0, 0, 0)
	else:
		print(g, s, b)


tests = int(input())

def compact(a):
	b = []
	count = 1
	prev = a[0]
	for i in range(1, len(a)):
		if a[i] == prev:
			count += 1
		else:
			b.append((prev, count))
			prev = a[i]
			count = 1
	if count > 0:
		b.append((prev, count))
	return b
for test in range(tests):
	n = int(input())
	p = list(map(int, input().split(' ')))
	groups = compact(p)
	limit = n // 2
	g = s = b = 0
	for i in range(len(groups)):
		(problems, count) = groups[i]
		if g == 0:
			g += count
		elif s <= g:
			s += count
		elif g + s + b + count <= limit:
			b += count
		else:
			break
	if (g and s and b) and g + s + b <= limit and (g < s and g < b):
		print('%d %d %d' % (g, s, b))
	else:
		print('0 0 0')


import sys
input = sys.stdin.readline
from collections import Counter
t = int(input())
for _ in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	cnt = Counter(p)
	l = list(cnt.items())
	l.sort(key=lambda k: k[0], reverse=True)
	g = l[0][1]
	s = 0
	for i in range(1, len(l)):
		s += l[i][1]
		if s > g:
			mark = i
			break
	if s <= g:
		print(0, 0, 0)
		continue
	b = 0
	for i in range(mark + 1, len(l)):
		if g + s + b + l[i][1] <= n // 2:
			b += l[i][1]
		else:
			break
	if b <= g:
		print(0, 0, 0)
		continue
	print(g, s, b)


from collections import Counter

def solve(n, ar):
	a = Counter(ar)
	a = list(dict(sorted(a.items())).values())
	a.reverse()
	ar = sorted(set(ar))
	ar.reverse()
	g = a[0]
	i = 1
	s = 0
	while s <= g and i < len(ar):
		s += a[i]
		i += 1
	if g < s:
		b = 0
		while b <= g and i < len(ar):
			b += a[i]
			i += 1
		while i < len(ar) and g + s + b + a[i] <= n // 2:
			b += a[i]
			i += 1
		if g < b and g + s + b <= n // 2:
			print(g, s, b)
			return
	print('0 0 0')
t = int(input())
for _ in range(t):
	n = int(input())
	ar = list(map(int, input().split()))
	solve(n, ar)


from math import sqrt, ceil

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(mi())

def si():
	return input()
abc = ['a', 'b', 'c']
t = ii()
while t:
	t -= 1
	n = ii()
	a = li()
	ma = n // 2
	x = a[ma]
	for i in range(ma, -1, -1):
		if a[i - 1] != a[ma]:
			break
	b = a[:i]
	b = list(set(b))
	b.sort(reverse=True)
	if len(b) >= 3:
		n1 = a.count(a[0])
		n2 = i - n1
		s = 0
		for k in range(1, len(b)):
			s += a.count(b[k])
			if s > n1:
				break
		b = n2 - s
		if n1 < s and n1 < b:
			print(n1, end=' ')
			print(s, end=' ')
			print(b)
		else:
			print('0 0 0')
	else:
		print('0 0 0')


import sys
import math
from collections import defaultdict
from collections import deque
from itertools import combinations
from itertools import permutations
input = lambda : sys.stdin.readline().rstrip()
read = lambda : list(map(int, input().split()))

def write(*args, sep='\n'):
	for i in args:
		sys.stdout.write('{}{}'.format(i, sep))
INF = float('inf')
MOD = int(1000000000.0 + 7)
YES = 'YES'
NO = '0 0 0'
d = {'a': 'b', 'b': 'c', 'c': 'a', '?': 'a'}
for _ in range(int(input())):
	n = int(input())
	max_award = n // 2
	arr = read()
	low = arr[-1]
	while arr and arr[-1] == low:
		arr.pop()
	if len(arr) < 5:
		print(NO)
		continue
	arr = arr[::-1]
	high = arr[-1]
	m = len(arr)
	g = 0
	while arr and arr[-1] == high:
		g += 1
		arr.pop()
	if not len(arr) >= 2 * (g + 1) or g >= max_award - 1:
		print(NO)
		continue
	s = 0
	while s <= g:
		if len(arr) == 0:
			break
		mid = arr[-1]
		while arr and arr[-1] == mid:
			s += 1
			arr.pop()
	if s <= g or g + s >= max_award or len(arr) == 0:
		print(NO)
		continue
	award = max_award - g - s
	b = 0
	temp = 0
	while 1:
		if not arr:
			break
		back = arr[-1]
		while arr and arr[-1] == back:
			temp += 1
			arr.pop()
		if temp <= award:
			b = max(b, temp)
		else:
			break
	if b == 0 or b <= g or g == 0 or (s == 0):
		print(NO)
	else:
		print(g, s, b)


def main(nums, l):
	nums = int(nums)
	values = {}
	i = 0
	total = 0
	while i < nums // 2 and total <= nums // 2:
		if values.get(l[i]) == None:
			values[l[i]] = 1
			total += 1
		else:
			values[l[i]] += 1
			total += 1
		i += 1
	if len(l) > i and values.get(l[i]) != None:
		values.pop(l[i])
	if len(values.keys()) < 3:
		print('0 0 0')
		return
	ans = list(values.values())
	r = [ans[0], 0, 0]
	i = 1
	while r[0] >= r[1] and i < len(ans):
		r[1] += ans[i]
		i += 1
	r[2] = sum(ans[i:])
	if r[0] < r[1] and r[0] < r[2]:
		print(str(r[0]), r[1], r[2])
		return
	print('0 0 0')

def runner():
	val = input()
	for i in range(int(val)):
		a = input()
		b = input()
		b = b.split(' ')
		main(a, b)
runner()


import sys

class CBeautifulRegionalContest:

	def solve(self):
		for _ in range(int(input())):
			n = int(input())
			p = [int(_) for _ in input().split()]
			cnt = {x: 0 for x in p}
			for x in p:
				cnt[x] += 1
			cnts = list(cnt.items())
			cnts.sort(reverse=True)
			s = 0
			i = 0
			while i < n and s + cnts[i][1] <= n // 2:
				s += cnts[i][1]
				i += 1
			k = i
			g = cnts[0][1]
			s = 0
			b = 0
			i = 1
			while i < k and s <= g:
				s += cnts[i][1]
				i += 1
			b = sum((cnts[i][1] for i in range(k))) - s - g
			if g < s and g < b and (g > 0) and (s > 0) and (b > 0):
				print(g, s, b)
			else:
				print(0, 0, 0)
solver = CBeautifulRegionalContest()
input = sys.stdin.readline
solver.solve()


z = int(input())
for zz in range(z):
	n = int(input())
	a = [int(i) for i in input().split()]
	mG = a[0]
	mS = -1
	mB = -1
	g = 1
	s = 0
	b = 0
	i = 1
	while i < n:
		if a[i] == mG:
			g += 1
		else:
			mS = a[i]
			break
		i += 1
	while i < n:
		if a[i] == mS:
			s += 1
		elif s <= g:
			mS = a[i]
			s += 1
		else:
			mB = a[i]
			break
		i += 1
	sI = i
	pI = i
	while i < n:
		if a[i] != mB:
			if i > n // 2:
				break
			else:
				pI = i - 1
				mB = a[i]
		i += 1
	b = pI - sI + 1
	if (s > g and b > g) and g + s + b <= n // 2:
		print(g, s, b)
	else:
		print(0, 0, 0)


t = int(input())
for i in range(t):
	n = int(input())
	plist = [int(x) for x in input().split(' ')]
	if n <= 5:
		print(0, 0, 0, sep=' ')
	else:
		for k in range(n):
			if plist[0] != plist[k]:
				break
		a = k
		b = 0
		c = 0
		while b <= a and a + b + c <= n / 2:
			for j in range(k + 1, n):
				if plist[k] != plist[j]:
					break
			x = j
			b = b + (x - k)
			k = x
		if b <= a:
			print(0, 0, 0, sep=' ')
		else:
			while a + b + c < n / 2:
				for j in range(k, n):
					if plist[k] != plist[j]:
						break
				if a + b + c + j - k > n / 2:
					break
				else:
					c += j - k
					k = j
			if c > a:
				print(a, b, c, sep=' ')
			else:
				print(0, 0, 0, sep=' ')


for i in range(int(input())):
	N = int(input())
	lis = list(map(int, input().split()))
	gsb = [0] * 3
	gsb[0] = 1
	pointer = 0
	length = len(lis) // 2
	for i in range(1, length):
		if lis[i] == lis[i - 1]:
			gsb[pointer] += 1
		elif pointer != 0 and gsb[pointer] <= gsb[0]:
			gsb[pointer] += 1
		elif pointer < 2:
			pointer += 1
			gsb[pointer] += 1
		else:
			gsb[pointer] += 1
	if lis[length] == lis[length - 1]:
		k = length - 1
		while k >= 0:
			if lis[k + 1] == lis[k]:
				gsb[2] -= 1
				k -= 1
			else:
				break
	if gsb[0] < gsb[1] and gsb[0] < gsb[2] and (gsb[1] > 0) and (gsb[2] > 0):
		for i in gsb:
			print(i, end=' ')
		print()
	else:
		for i in range(3):
			print(0, end=' ')
		print()


import sys

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7
for _ in range(INT()):
	N = INT()
	A = LIST()
	if N < 10:
		print(0, 0, 0)
		continue
	g = s = b = 0
	g += 1
	for i in range(1, N):
		if A[i - 1] == A[i]:
			g += 1
		else:
			idx = i
			break
	else:
		print(0, 0, 0)
		continue
	s += 1
	for i in range(idx + 1, N):
		if A[i - 1] == A[i] or s <= g:
			s += 1
		else:
			idx = i
			break
	else:
		print(0, 0, 0)
		continue
	half = N // 2
	if g + s >= half:
		print(0, 0, 0)
		continue
	b += half - idx
	for i in range(half - 1, -1, -1):
		if A[i] == A[i + 1]:
			b -= 1
		else:
			break
	if b <= 0 or b <= g:
		print(0, 0, 0)
		continue
	print(g, s, b)


import sys
import math
from collections import defaultdict, Counter, deque
import bisect
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	g = s = b = 0
	ele = a[n // 2]
	c = Counter(a)
	l = sorted(c.items(), reverse=True)
	flag = 1
	for j in range(len(l)):
		if l[j][0] <= ele:
			flag = 0
			break
		g = l[j][1]
		ind = j + 1
		break
	if flag:
		for j in range(ind, len(l)):
			if l[j][0] <= ele:
				flag = 0
				break
			s += l[j][1]
			if s > g:
				ind = j + 1
				break
	if flag:
		for j in range(ind, len(l)):
			if l[j][0] <= ele:
				break
			b += l[j][1]
	if g > 0 and s > 0 and (b > 0) and (g < s) and (g < b):
		print(g, s, b)
	else:
		print(0, 0, 0)


from collections import OrderedDict
t = int(input())
while t > 0:
	n = int(input())
	a = [int(i) for i in input().split()]
	k = a[-1]
	d = OrderedDict()
	for i in a:
		if i not in d:
			d[i] = 1
		else:
			d[i] += 1
	last = d[k]
	c = len(d.keys())
	prize = n // 2
	if c >= 4:
		n = n - last
		if n > 3:
			g = d[a[0]]
			total = g
			s = 0
			b = 0
			for i in d.keys():
				if i == a[0]:
					pass
				else:
					total += d[i]
					if s <= g and total <= prize and (i != k):
						s += d[i]
					elif total <= prize and i != k:
						b += d[i]
			if g < s and g < b:
				print(g, s, b)
			else:
				print('0 0 0')
		else:
			print('0 0 0')
	else:
		print('0 0 0')
	t -= 1


t = int(input())
for i in range(t):
	n = int(input())
	num = input(' ')
	a = [int(k) for k in num.split()]
	g = 1
	while g < n and a[g] == a[g - 1]:
		g += 1
	s = 2 * g + 1
	while s < n and a[s] == a[s - 1]:
		s += 1
	b = int(n / 2)
	while b > 0 and a[b] == a[b - 1]:
		b -= 1
	if b - s > g:
		print(g, s - g, b - s)
	else:
		print('0 0 0')


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	if n < 6:
		print(0, 0, 0)
		continue
	a = n // 2 - 1
	while l[a] == l[n // 2] and a >= 0:
		a -= 1
	if a < 2:
		print(0, 0, 0)
		continue
	l = l[:a + 1].copy()
	b = len(l)
	d = Counter(l)
	l = set(l)
	if len(d) < 3:
		print(0, 0, 0)
		continue
	(g, s) = (0, 0)
	a = sorted(l)[-1]
	if d[a] > b // 2:
		print(0, 0, 0)
		continue
	else:
		g = d[a]
		l.remove(a)
	for i in sorted(l)[::-1]:
		s += d[i]
		if s > g:
			break
	if b - s - g <= g:
		print(0, 0, 0)
	else:
		print(g, s, b - s - g)


import sys, math, itertools
from collections import Counter, deque, defaultdict
from bisect import bisect_left, bisect_right
mod = 10 ** 9 + 7
INF = float('inf')

def inp():
	return int(sys.stdin.readline())

def inpl():
	return list(map(int, sys.stdin.readline().split()))
for _ in range(inp()):
	n = inp()
	a = inpl()
	c = Counter(a)
	tmp = list(c)
	tmp.sort(reverse=True)
	cnt = 0
	per = []
	for key in tmp:
		if c[key] + cnt > n // 2:
			break
		cnt += c[key]
		per.append(c[key])
	ln = len(per)
	if ln < 3:
		print(0, 0, 0)
		continue
	gold = per[0]
	bronze = sum(per) - gold
	silver = 0
	for i in range(1, ln - 1):
		silver += per[i]
		bronze -= per[i]
		if silver > gold and bronze > gold:
			break
	else:
		print(0, 0, 0)
		continue
	print(gold, silver, bronze)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	medals = n // 2
	g = 0
	s = 0
	b = 0
	m = {}
	for elem in a:
		m[elem] = 1 + m.get(elem, 0)
	freq = []
	count = 0
	for elem in m:
		count += m[elem]
		freq.append(count)
	st = 0
	e = len(freq) - 1
	ans = 0
	while st <= e:
		mid = (st + e) // 2
		if freq[mid] <= medals:
			ans = freq[mid]
			st = mid + 1
		elif freq[mid] > medals:
			e = mid - 1
	g = m[a[0]]
	ans -= g
	if ans > 0:
		for elem in m:
			if elem != a[0]:
				s += m[elem]
				if s > g:
					break
		ans -= s
		if ans > 0:
			b = ans
			if b > g:
				print(g, s, b)
			else:
				print(0, 0, 0)
		else:
			print(0, 0, 0)
	else:
		print(0, 0, 0)


from collections import Counter

def solve(arr):
	mapper = Counter(arr)
	max_medals = len(arr) // 2
	if max_medals < 3:
		return [0, 0, 0]
	medals = [0, 0, 0]
	medals[0] = mapper[arr[0]]
	bound = mapper[arr[0]]
	while medals[1] <= medals[0] and sum(medals) <= max_medals:
		medals[1] += mapper[arr[bound]]
		bound += mapper[arr[bound]]
	while bound < len(arr) and sum(medals) + mapper[arr[bound]] <= max_medals:
		medals[2] += mapper[arr[bound]]
		bound += mapper[arr[bound]]
	if medals[0] >= medals[2]:
		return [0, 0, 0]
	return medals
tests = int(input())
res = []
for i in range(tests):
	input()
	inp = list(map(int, input().split()))
	res.append(' '.join(list(map(str, solve(inp)))))
print('\n'.join(res))


def solve():
	s = input()
	if 'aa' in s or 'bb' in s or 'cc' in s:
		print(-1)
		return
	syms = s + '@'
	ans = ['@']
	for (i, sym) in enumerate(s):
		if sym != '?':
			ans.append(sym)
			continue
		for x in 'abc':
			if x != ans[-1] and x != syms[i + 1]:
				ans.append(x)
				break
	print(''.join(ans[1:]))

def solveb():
	n = int(input())
	perm = [int(x) for x in input().split()]
	num___idx = [-1 for _ in range(n + 1)]
	for (i, num) in enumerate(perm):
		num___idx[num] = i
	curr_max = -1
	curr_min = 2 * n
	num___pretty = [0 for _ in range(n + 1)]
	for num in range(1, n + 1):
		curr_max = max(num___idx[num], curr_max)
		curr_min = min(num___idx[num], curr_min)
		if curr_max - curr_min + 1 == num:
			num___pretty[num] = 1
	print(*num___pretty[1:], sep='')

def solvec():
	n = int(input())
	rank___problems_nr = [int(x) for x in input().split()]
	weird_prefsums = [0]
	last_num = rank___problems_nr[0]
	for num in rank___problems_nr:
		if num != last_num:
			last_num = num
			weird_prefsums.append(weird_prefsums[-1])
		weird_prefsums[-1] += 1
	gold = weird_prefsums[0]
	silvers = 0
	i = 1
	for i in range(1, len(weird_prefsums)):
		x = weird_prefsums[i]
		if x - gold > gold:
			silvers = x - gold
			break
	bronzes = 0
	for j in range(i, len(weird_prefsums)):
		x = weird_prefsums[j]
		if x > n / 2:
			break
		if x - gold - silvers > gold:
			bronzes = x - gold - silvers
	if bronzes == 0 or silvers == 0:
		print(0, 0, 0)
		return
	print(gold, silvers, bronzes)
for _ in range(int(input())):
	solvec()


import sys
import math

def kek():
	t = int(input())
	for _ in range(t):
		sys.stdin.readline()
		a = list(reversed(sorted(list(map(int, sys.stdin.readline().split())))))
		par = []
		s = 1
		for i in range(1, len(a)):
			if a[i] != a[i - 1]:
				par.append(s)
				s = 0
			s += 1
		par.append(s)
		sGold = par[0]
		sumPers = len(a)
		sSilv = 0
		sBronze = 0
		ind = len(par) - 1
		for i in range(1, len(par)):
			sSilv += par[i]
			if sSilv > sGold:
				ind = i
				break
		for i in range(ind + 1, len(par)):
			sBronze += par[i]
			if sBronze + sSilv + sGold > sumPers // 2:
				sBronze -= par[i]
				break
		if sGold >= sSilv or sGold >= sBronze or sBronze == 0 or (sGold == 0) or (sSilv == 0) or (len(par) < 3):
			print(0, 0, 0)
		else:
			print(sGold, sSilv, sBronze)
kek()


from collections import defaultdict as dc
import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	x = dc(int)
	for i in l:
		x[i] += 1
	p = sorted(x.keys(), reverse=True)
	c = 0
	i = 0
	m = len(p)
	g = 0
	s = 0
	b = 0
	if c + x[p[0]] <= n // 2:
		g = x[p[0]]
		c += x[p[0]]
	i = 1
	while c < n // 2 and i < m and (s <= g):
		if c + x[p[i]] <= n // 2:
			s += x[p[i]]
			c += x[p[i]]
		else:
			break
		i += 1
	while c < n // 2 and i < m:
		if c + x[p[i]] <= n // 2:
			b += x[p[i]]
			c += x[p[i]]
		else:
			break
		i += 1
	if g == 0 or s == 0 or b == 0:
		print(0, 0, 0)
	elif g >= s or g >= b:
		print(0, 0, 0)
	else:
		print(g, s, b)


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	if n // 2 < 3:
		print(0, 0, 0)
		continue
	i = n // 2 - 1
	while l[i] == l[i + 1] and i > 0:
		i -= 1
	if i + 1 < 3:
		print(0, 0, 0)
		continue
	if len(set(l[0:i + 1])) < 3:
		print(0, 0, 0)
		continue
	else:
		l1 = l[0:i + 1]
		g = 1
		k = 0
		while k < len(l1) and l1[k] == l1[k + 1]:
			g += 1
			k += 1
		k += 1
		s = 1
		while s <= g:
			s = s + 1
			k += 1
		k += 1
		while k < len(l1) and l1[k - 1] == l1[k]:
			s += 1
			k += 1
		b = len(l1) - g - s
		if g >= s or g >= b:
			print(0, 0, 0)
			continue
		print(g, s, b)


import sys
input = sys.stdin.buffer.readline
ans = []
t = int(input())
for _ in range(t):
	n = int(input())
	p = [int(x) for x in input().split()]
	if n < 10:
		ans.append('0 0 0')
		continue
	midIndex = n // 2 - 1
	breakVal = p[midIndex + 1]
	for lastBronze in range(midIndex, -1, -1):
		if p[lastBronze] != breakVal:
			break
	g = 0
	gVal = p[0]
	for i in range(n):
		if p[i] != gVal:
			break
		g += 1
	s = g + 1
	if g + s - 1 >= n:
		ans.append('0 0 0')
		continue
	sVal = p[g + s - 1]
	for i in range(g + s, n):
		if p[i] != sVal:
			break
		s += 1
	b = lastBronze + 1 - g - s
	if b <= g:
		ans.append('0 0 0')
		continue
	ans.append('{} {} {}'.format(g, s, b))
print('\n'.join(ans))


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import *
from copy import *
from collections import deque
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def chck(g, bs):
	if bs - (g + 1) > g:
		return True
	return False

def solve():
	n = int(inp())
	p = lis()
	cnt = {}
	for i in range(n):
		if p[i] in cnt:
			cnt[p[i]] += 1
		else:
			cnt[p[i]] = 1
	freq = []
	for i in cnt:
		freq.append([i, cnt[i]])
	freq = sorted(freq)[::-1]
	x = n // 2
	temp = 0
	ind = n
	for i in range(len(freq)):
		temp += freq[i][1]
		if temp >= x:
			ind = i + 1
			break
	new = []
	for i in range(ind):
		new.append(freq[i][1])
	g = new[0]
	ind = n
	s = 0
	for i in range(1, len(new)):
		s += new[i]
		if s > g:
			ind = i + 1
			break
	b = 0
	for i in range(ind, len(new)):
		b += new[i]
		if b + g + s > x:
			b -= new[i]
			break
	if g < s and g < b:
		print(g, s, b)
	else:
		print(0, 0, 0)
testcase(int(inp()))


n = int(input())
for j in range(n):
	m = int(input())
	L = [int(e) for e in input().strip().split()]
	L = L[:len(L) // 2 + 1]
	if len(L) == 1:
		pass
	elif L[-1] == L[-2]:
		i = -2
		while i >= len(L) * -1 and L[i] == L[-1]:
			i -= 1
		L = L[:i + 1]
	else:
		L = L[:-1]
	if len(L) == 0:
		L = [9999]
	L2 = []
	tmp = L[0]
	count = 0
	for i in range(len(L)):
		if L[i] == tmp:
			count += 1
		else:
			L2.append(count)
			count = 1
			tmp = L[i]
		if i == len(L) - 1:
			L2.append(count)
	if len(L2) > 3:
		ans = [0, 0, 0]
		ans[0] = L2[0]
		i = 2
		silver = L2[1]
		while silver <= ans[0] and i <= len(L2) - 1:
			silver += L2[i]
			i += 1
		ans[1] = silver
		if i <= len(L2) - 1:
			ans[2] = sum(L2[i:])
	elif len(L2) == 1:
		ans = L2 + [0, 0]
	elif len(L2) == 2:
		ans = L2 + [0]
	else:
		ans = L2
	if ans[1] == 0 or ans[2] == 0:
		ans = [0] * 3
	if ans[1] <= ans[0] or ans[2] <= ans[0]:
		ans = [0] * 3
	print(' '.join([str(e) for e in ans]))