You have a sequence of $n$ colored blocks. The color of the $i$-th block is $c_i$, an integer between $1$ and $n$.

You will place the blocks down in sequence on an infinite coordinate grid in the following way.

Initially, you place block $1$ at $(0, 0)$.

For $2 \le i \le n$, if the $(i - 1)$-th block is placed at position $(x, y)$, then the $i$-th block can be placed at one of positions $(x + 1, y)$, $(x - 1, y)$, $(x, y + 1)$ (but not at position $(x, y - 1)$), as long no previous block was placed at that position.

A tower is formed by $s$ blocks such that they are placed at positions $(x, y), (x, y + 1), \ldots, (x, y + s - 1)$ for some position $(x, y)$ and integer $s$. The size of the tower is $s$, the number of blocks in it. A tower of color $r$ is a tower such that all blocks in it have the color $r$.

For each color $r$ from $1$ to $n$, solve the following problem independently:

Find the maximum size of a tower of color $r$ that you can form by placing down the blocks according to the rules.


-----Input-----

The first line contains a single integer $t$ ($1 \le t \le 10^4$) — the number of test cases.

The first line of each test case contains a single integer $n$ ($1 \le n \le 10^5$).

The second line of each test case contains $n$ integers $c_1, c_2, \ldots, c_n$ ($1 \le c_i \le n$).

It is guaranteed that the sum of $n$ over all test cases does not exceed $2 \cdot 10^5$.


-----Output-----

For each test case, output $n$ integers. The $r$-th of them should be the maximum size of an tower of color $r$ you can form by following the given rules. If you cannot form any tower of color $r$, the $r$-th integer should be $0$.


-----Examples-----

Input
6
7
1 2 3 1 2 3 1
6
4 2 2 2 4 4
1
1
5
5 4 5 3 5
6
3 3 3 1 3 3
8
1 2 3 4 4 3 2 1
Output
3 2 2 0 0 0 0 
0 3 0 2 0 0 
1 
0 0 1 1 1 
1 0 4 0 0 0 
2 2 2 2 0 0 0 0


-----Note-----

In the first test case, one of the possible ways to form a tower of color $1$ and size $3$ is:

place block $1$ at position $(0, 0)$;

place block $2$ to the right of block $1$, at position $(1, 0)$;

place block $3$ above block $2$, at position $(1, 1)$;

place block $4$ to the left of block $3$, at position $(0, 1)$;

place block $5$ to the left of block $4$, at position $(-1, 1)$;

place block $6$ above block $5$, at position $(-1, 2)$;

place block $7$ to the right of block $6$, at position $(0, 2)$.

The blocks at positions $(0, 0)$, $(0, 1)$, and $(0, 2)$ all have color $1$, forming an tower of size $3$.

In the second test case, note that the following placement is not valid, since you are not allowed to place block $6$ under block $5$:

It can be shown that it is impossible to form a tower of color $4$ and size $3$.

Difficulty: EASY

Solutions:
t = int(input())
ans = list()
for i in range(0, t):
	n = int(input())
	arr = list(map(int, input().split()))
	t = n * [0]
	p = n * [-1]
	for i in range(0, n):
		if t[arr[i] - 1] == 0:
			t[arr[i] - 1] = 1
		if p[arr[i] - 1] != -1 and (p[arr[i] - 1] - i) % 2 == 1:
			t[arr[i] - 1] += 1
		p[arr[i] - 1] = i
	s = ''
	for x in t:
		s += f'{x} '
	ans.append(s)
for s in ans:
	print(s)


trails = int(input())
for x in range(trails):
	n = int(input())
	k = input().split(' ')
	ans = [0] * n
	li = [-1] * n
	index = -1
	for p in k:
		index += 1
		g = int(p)
		li_val = li[g - 1]
		if (index - li_val) % 2 == 1 or li_val == -1:
			ans[g - 1] = ans[g - 1] + 1
		li[g - 1] = index
	ans_str = ''
	for i in ans:
		ans_str += str(i)
		ans_str += ' '
	print(ans_str)


def main():
	n = int(input())
	arr = list(map(int, input().split()))
	last = [-1] * (n + 1)
	final = [0] * (n + 1)
	for i in range(n):
		curr = arr[i]
		if final[curr] == 0:
			final[curr] = 1
			last[curr] = i
		elif (i - last[curr]) % 2:
			last[curr] = i
			final[curr] += 1
	for z in final[1:]:
		print(z, end=' ')
	print()
	return
for _ in range(int(input())):
	main()


for qwerty in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l1 = [0] * n + [0]
	ans = ''
	for (j, i) in enumerate(l):
		if l1[i] == 0:
			l1[i] = [j % 2]
			continue
		l1[i] += [j % 2]
	for i in range(1, n + 1):
		t = l1[i]
		if t == 0:
			ans += '0 '
		else:
			ans1 = 1
			x = t[0]
			for i in t:
				if x == 0:
					if i == 1:
						ans1 += 1
						x = 1
				elif i == 0:
					ans1 += 1
					x = 0
			ans += str(ans1) + ' '
	print(ans)


for _ in range(int(input())):
	n = int(input())
	mass = list(map(int, input().split()))
	f = {}
	for i in range(n):
		if mass[i] not in f:
			f[mass[i]] = []
		f[mass[i]].append(i)
	s = ''
	for i in range(1, n + 1):
		if i not in f:
			s += '0 '
		else:
			w = f[i]
			k = 1
			otv = 1
			if len(w) > 1:
				for j in range(1, len(w)):
					if (w[j] - w[j - 1] - 1) % 2 == 0:
						k += 1
					otv = max(otv, k)
			s += f'{otv} '
	print(s)


test = int(input())

def value(array, n):
	hmap = {}
	for i in range(n):
		if array[i] not in hmap:
			hmap[array[i]] = [i]
		else:
			hmap[array[i]].append(i)
	result = [0 for i in range(n)]
	for i in range(n):
		if i + 1 in hmap:
			indices = hmap[i + 1]
			oddCount = 0
			evenCount = 0
			odd = True
			even = True
			for index in indices:
				if odd and index % 2 == 1:
					oddCount += 1
					odd = False
				elif not odd and index % 2 == 0:
					oddCount += 1
					odd = True
				if even and index % 2 == 0:
					evenCount += 1
					even = False
				elif not even and index % 2 == 1:
					evenCount += 1
					even = True
			result[i] = max(evenCount, oddCount)
	answer = []
	for num in result:
		answer.append(str(num))
		answer.append(' ')
	return ''.join(answer)
for i in range(test):
	n = int(input())
	array = list(map(int, input().split()))
	print(value(array, n))


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	for i in range(n):
		arr[i] = arr[i] - 1
	sign = [0 for i in range(n)]
	ind = [0 for i in range(n)]
	cnt = [0 for i in range(n)]
	for i in range(n):
		if sign[arr[i]] == 0:
			sign[arr[i]] = 1
			ind[arr[i]] = i
			cnt[arr[i]] = 1
		else:
			if (ind[arr[i]] - i) % 2 == 1:
				cnt[arr[i]] += 1
			ind[arr[i]] = i
	s = ''
	for i in range(n):
		s += str(cnt[i]) + ' '
	print(s)


t = int(input())
for _ in range(t):
	n = int(input())
	lst = list(map(int, input().split()))
	dic = {}
	ans = [0] * (n + 1)
	for i in range(len(lst)):
		if lst[i] in dic:
			if i % 2 != dic[lst[i]]:
				ans[lst[i]] += 1
				dic[lst[i]] = i % 2
		else:
			dic[lst[i]] = i % 2
			ans[lst[i]] = 1
	for i in ans[1:]:
		print(i, end=' ')
	print()


t = int(input())
for i in range(t):
	n = int(input())
	nums = [int(temp) for temp in input().split()]
	first = [-1] * (n + 1)
	odds = [0] * (n + 1)
	for i in range(n):
		x = nums[i]
		if first[x] == -1:
			odds[x] += 1
			first[x] = i
		elif (i - first[x] - 1) % 2 == 0:
			odds[x] += 1
			first[x] = i
	for i in range(1, n + 1):
		print(odds[i], end=' ')
	print()


T = int(input())
for t in range(T):
	n = int(input())
	arr = input().split()
	arr = list(map(int, arr))
	(x, y) = (0, 0)
	ans = [0] * n
	ind = [-1] * n
	p = arr[0] - 1
	ans[p] = 1
	ind[p] = 0
	for i in range(1, n):
		p = arr[i] - 1
		if ind[p] == -1:
			ans[p] = 1
			ind[p] = i
		elif i - ind[p] == 1 or (i - ind[p]) % 2 != 0:
			ans[p] += 1
		ind[p] = i
	for i in ans:
		print(i, end=' ')
	print()


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	size = [0] * n
	mydict = {}
	for i in range(n):
		if a[i] not in mydict:
			size[a[i] - 1] += 1
			mydict[a[i]] = i
		elif (i - mydict[a[i]] + 1) % 2 == 0:
			size[a[i] - 1] += 1
			mydict[a[i]] = i
	for s in size:
		print(s, end=' ')
	print()


import sys
input = sys.stdin.readline
from collections import defaultdict
t = int(input())
for _ in range(t):
	saveIdx = defaultdict(list)
	n = int(input())
	order = list(map(int, input().split()))
	answer = [0] * (n + 1)
	for i in range(n):
		if order[i] in saveIdx:
			if (i + 1 - saveIdx[order[i]][0]) % 2 == 1:
				saveIdx[order[i]][0] = i + 1
				saveIdx[order[i]][1] += 1
		else:
			saveIdx[order[i]] = [i + 1, 1]
	for key in saveIdx.keys():
		answer[key] = saveIdx[key][1]
	for j in range(1, len(answer)):
		print(answer[j], end=' ')
	print()


def solve():
	n = int(input())
	lst = list(map(int, input().split(' ')))
	dct = {}
	ans = [0] * n
	for i in range(n):
		if lst[i] in dct:
			dct[lst[i]].append(i)
		else:
			dct[lst[i]] = [i]
	for i in dct:
		cnt = 1
		for j in range(len(dct[i]) - 1):
			if (dct[i][j + 1] - dct[i][j]) % 2:
				cnt += 1
		ans[i - 1] = cnt
	for i in ans:
		print(i, end=' ')
	print()
t = int(input())
while t:
	t -= 1
	solve()


import sys
inp = sys.stdin.readline
for _ in range(int(inp())):
	n = int(inp())
	c = list(map(int, inp().split()))
	res = {}
	for i in range(n):
		try:
			res[c[i]]
			if (i - res[c[i]][0] - 1) % 2 == 0:
				res[c[i]][1] += 1
			res[c[i]][0] = i
		except Exception:
			res[c[i]] = [i, 1]
	for i in range(1, n + 1):
		if i in res:
			print(res[i][1], end=' ')
		else:
			print(0, end=' ')
	print()


for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	maxi = [0] * (n + 1)
	if 3434 == 'dfdjfhgrh':
		print('Tanmay')
	prev = [0] * (n + 1)
	c = [0] * (n + 1)
	for i in range(1, n + 1):
		x = a[i - 1]
		if prev[x] == 0:
			c[x] += 1
			maxi[x] += 1
			prev[x] = i
			continue
		if (i - prev[x]) % 2 == 1:
			c[x] += 1
			maxi[x] = max(c[x], maxi[x])
			prev[x] = i
	for i in maxi[1:]:
		print(i, end=' ')
	print()


def main():
	for t in range(int(input())):
		n = int(input())
		c = [0] + list(map(int, input().split()))
		ans = [[] for i in range(n + 1)]
		pre = [0 for i in range(n + 1)]
		for i in range(1, n + 1):
			if pre[c[i]] == 0:
				ans[c[i]].append(1)
				pre[c[i]] = i
			elif (i - pre[c[i]] - 1) % 2 == 0:
				ans[c[i]][-1] += 1
				pre[c[i]] = i
		for i in range(1, n + 1):
			if len(ans[i]) == 0:
				print(0, end=' ')
			else:
				print(max(ans[i]), end=' ')
		print()
main()


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(x) for x in input().split()]
	res = [0] * n
	for i in range(n):
		arr[i] -= 1
		if res[arr[i]] == 0:
			res[arr[i]] = 1
	seen = {}
	for i in range(n):
		color = arr[i]
		if color not in seen:
			seen[color] = i
		else:
			if (i - seen[color]) % 2 == 1:
				res[color] += 1
			seen[color] = i
	for val in res:
		print(val, end=' ')
	print()


cases = int(input())
for _ in range(cases):
	n = int(input())
	last_index = [None] * (n + 1)
	height = [0] * (n + 1)
	colors = list(map(lambda x: int(x), input().split(' ')))
	for i in range(len(colors)):
		if last_index[colors[i]] == None:
			last_index[colors[i]] = i
			height[colors[i]] += 1
		elif (i - last_index[colors[i]] - 1) % 2 == 0:
			last_index[colors[i]] = i
			height[colors[i]] += 1
	for i in range(1, n + 1):
		print(height[i], end=' ')
	print()


T = int(input())
while T:
	n = int(input())
	l = list(map(int, input().split()))
	info = {}
	for i in range(n):
		if l[i] not in info:
			info[l[i]] = [i, 1]
		elif (i - info[l[i]][0] - 1) % 2 == 0:
			t = info[l[i]][1] + 1
			info[l[i]] = [i, t]
		else:
			info[l[i]][0] = i
	for j in range(1, n + 1):
		if j not in info:
			print(0, end=' ')
		else:
			print(info[j][1], end=' ')
	print()
	T -= 1


for _ in [0] * int(input()):
	n = int(input())
	(*c,) = map(int, input().split())
	b = [[0, -1] for i in range(n + 1)]
	for i in range(n):
		if (i - b[c[i]][1]) % 2 or b[c[i]][1] == -1:
			b[c[i]][0] += 1
		b[c[i]][1] = i
	for i in range(n):
		print(b[i + 1][0], end=' ')
	print()


t = int(input())
for _ in range(t):
	n = int(input())
	c = list(map(int, input().split()))
	d = {}
	cnt = {}
	for i in range(n):
		if c[i] in d:
			x = i - d[c[i]]
			if x % 2 == 1:
				if c[i] in cnt:
					cnt[c[i]] += 1
				else:
					cnt[c[i]] = 2
		d[c[i]] = i
	for k in range(1, n + 1):
		if k in cnt:
			print(cnt[k], end=' ')
		elif k in d:
			print(1, end=' ')
		else:
			print(0, end=' ')
	print()