You are given a tree of $n$ vertices numbered from $1$ to $n$, with edges numbered from $1$ to $n-1$. A tree is a connected undirected graph without cycles. You have to assign integer weights to each edge of the tree, such that the resultant graph is a prime tree.

A prime tree is a tree where the weight of every path consisting of one or two edges is prime. A path should not visit any vertex twice. The weight of a path is the sum of edge weights on that path.

Consider the graph below. It is a prime tree as the weight of every path of two or less edges is prime. For example, the following path of two edges: $2 \to 1 \to 3$ has a weight of $11 + 2 = 13$, which is prime. Similarly, the path of one edge: $4 \to 3$ has a weight of $5$, which is also prime.

Print any valid assignment of weights such that the resultant tree is a prime tree. If there is no such assignment, then print $-1$. It can be proven that if a valid assignment exists, one exists with weights between $1$ and $10^5$ as well.


-----Input-----

The input consists of multiple test cases. The first line contains an integer $t$ ($1 \leq t \leq 10^4$) — the number of test cases. The description of the test cases follows.

The first line of each test case contains one integer $n$ ($2 \leq n \leq 10^5$) — the number of vertices in the tree.

Then, $n-1$ lines follow. The $i$-th line contains two integers $u$ and $v$ ($1 \leq u, v \leq n$) denoting that edge number $i$ is between vertices $u$ and $v$. It is guaranteed that the edges form a tree.

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


-----Output-----

For each test case, if a valid assignment exists, then print a single line containing $n-1$ integers $a_1, a_2, \dots, a_{n-1}$ ($1 \leq a_i \le 10^5$), where $a_i$ denotes the weight assigned to the edge numbered $i$. Otherwise, print $-1$.

If there are multiple solutions, you may print any.


-----Examples-----

Input
3
2
1 2
4
1 3
4 3
2 1
7
1 2
1 3
3 4
3 5
6 2
7 2
Output
17
2 5 11
-1


-----Note-----

For the first test case, there are only two paths having one edge each: $1 \to 2$ and $2 \to 1$, both having a weight of $17$, which is prime.

The second test case is described in the statement.

It can be proven that no such assignment exists for the third test case.

Difficulty: MEDIUM

Solutions:
import sys
input = sys.stdin.readline
t = int(input())
out = []
for _ in range(t):
	n = int(input())
	cons = [[] for _ in range(n)]
	isGood = True
	for i in range(n - 1):
		(a, b) = [int(x) - 1 for x in input().split()]
		cons[a].append([b, i])
		cons[b].append([a, i])
		if len(cons[a]) == 3 or len(cons[b]) == 3:
			isGood = False
	if not isGood:
		out.append('-1\n')
		continue
	for i in range(len(cons)):
		if len(cons[i]) == 1:
			start = i
			break
	weights = [0] * (n - 1)
	next_ = 2
	search = [start]
	while len(search) > 0:
		node = search.pop(-1)
		for (child, ind) in cons[node]:
			if weights[ind] == 0:
				weights[ind] = next_
				search.append(child)
				next_ = 5 - next_
	strWeights = ''
	for x in weights:
		strWeights += str(x) + ' '
	out.append(strWeights + '\n')
print(''.join(out))


import sys, collections

def solve(n, loc, conn, su, sv):
	for u in conn:
		if len(conn[u]) > 2:
			return [-1]
	res = [-1] * (n - 1)
	res[loc[su, sv]] = 2
	level = {su, sv}
	value = 2
	while level:
		nextlevel = set()
		value = 5 - value
		for prev in level:
			for curr in conn[prev]:
				if (prev, curr) in loc:
					if res[loc[prev, curr]] != -1:
						continue
					res[loc[prev, curr]] = value
					nextlevel.add(curr)
				else:
					if res[loc[curr, prev]] != -1:
						continue
					res[loc[curr, prev]] = value
					nextlevel.add(curr)
		level = nextlevel
	return res
input = sys.stdin.readline
t = int(input()[:-1])
for _ in range(t):
	n = int(input()[:-1])
	loc = {}
	conn = collections.defaultdict(set)
	for i in range(n - 1):
		(u, v) = [int(part) for part in input()[:-1].split()]
		loc[u, v] = i
		conn[u].add(v)
		conn[v].add(u)
	res = solve(n, loc, conn, u, v)
	if res[0] == -1:
		print(-1)
	else:
		for val in res:
			print(val, end=' ')
		print('\n', end='')


def dfs(graph, start):
	result = dict()
	value = 2
	for el in graph[start]:
		visited = {start, el}
		result[tuple(sorted([start, el]))] = value
		last = el
		while True:
			value = 3 if value == 2 else 2
			neighbours = graph[last] - visited
			if len(neighbours) == 0:
				break
			elem = neighbours.pop()
			result[tuple(sorted([last, elem]))] = value
			visited.add(elem)
			last = elem
		value = 3
	return result

def solve():
	for i in range(int(input())):
		count = dict()
		pairs = []
		graph = dict()
		br = 0
		for j in range(int(input()) - 1):
			(a, b) = list(sorted(map(int, input().split())))
			pairs.append((a, b))
			graph[a] = graph.get(a, set())
			graph[a].add(b)
			graph[b] = graph.get(b, set())
			graph[b].add(a)
			count[a] = count.get(a, 0) + 1
			count[b] = count.get(b, 0) + 1
			if count[a] == 3 or count[b] == 3:
				br = -1
		if br == -1:
			print(br)
			continue
		result = dfs(graph, pairs[0][0])
		for pair in pairs:
			print(result[pair], end=' ')
		print()
solve()


t = int(input())
while t:
	t -= 1
	n = int(input())
	d = {}
	ans = {}
	for i in range(n - 1):
		(u, v) = map(int, input().split())
		if u not in d:
			d[u] = []
		if v not in d:
			d[v] = []
		d[u].append(v)
		d[v].append(u)
		ans[u, v] = 0
	r = 0
	key = 1
	for i in d:
		if len(d[i]) == 1:
			key = i
		if len(d[i]) >= 3:
			r = 1
			break
	if r == 1:
		print(-1)
		continue
	visited = [0 for i in range(n + 1)]
	st = []
	st.append((0, key))
	f = -1
	while st:
		key = st[-1]
		i = st[-1][1]
		st.pop()
		if visited[i] == 1:
			continue
		if visited[i] == 0 and f != -1:
			if f == 0:
				f = 1
				if key not in ans:
					ans[key[1], key[0]] = 2
				else:
					ans[key] = 2
			else:
				f = 0
				if key not in ans:
					ans[key[1], key[0]] = 3
				else:
					ans[key] = 3
		if f == -1:
			f = 0
		for e in d[i]:
			if visited[e] == 0:
				st.append((i, e))
		visited[i] = 1
	for i in ans:
		if ans[i] > 0:
			print(ans[i], end=' ')
	print()