You have a set of dominoes. Each domino is a rectangular tile with a line dividing its face into two square ends. Can you put all dominoes in a line one by one from left to right so that any two dominoes touched with the sides that had the same number of points? You can rotate the dominoes, changing the left and the right side (domino "1-4" turns into "4-1").

Input

The first line contains number n (1 ≤ n ≤ 100). Next n lines contains the dominoes. Each of these lines contains two numbers — the number of points (spots) on the left and the right half, correspondingly. The numbers of points (spots) are non-negative integers from 0 to 6.

Output

Print "No solution", if it is impossible to arrange the dominoes in the required manner. If the solution exists, then describe any way to arrange the dominoes. You put the dominoes from left to right. In each of n lines print the index of the domino to put in the corresponding position and then, after a space, character "+" (if you don't need to turn the domino) or "–" (if you need to turn it).

Examples

Input

5
1 2
2 4
2 4
6 4
2 1


Output

2 -
1 -
5 -
3 +
4 -

Source: codeforces | Difficulty: HARD
Tags: Graph algorithms

Graph traversal


Solutions:
def euler(start):
	s = [(start, 0)]
	ans = []
	while s:
		(i, e) = s[-1]
		if i in mark:
			mark.remove(i)
		if degree[i] == 0:
			ans.append(e)
			s.pop()
		else:
			for (j, e) in graph[i]:
				if vis[abs(e)] == 0:
					degree[i] -= 1
					degree[j] -= 1
					vis[abs(e)] = 1
					s.append((j, e))
					break
	if mark:
		print('No solution')
	else:
		for i in ans:
			if i < 0:
				print(-i, '+')
			elif i > 0:
				print(i, '-')
n = int(input())
degree = [0] * 7
vis = [0] * (n + 1)
graph = [[] for _ in range(7)]
start = 0
mark = set()
for i in range(1, 1 + n):
	(x, y) = map(int, input().split())
	graph[x].append((y, i))
	graph[y].append((x, -i))
	degree[x] += 1
	degree[y] += 1
	mark.add(x)
	mark.add(y)
	start = x
odd = 0
for i in range(0, 7):
	if degree[i] % 2 == 1:
		odd += 1
		start = i
if odd not in [0, 2]:
	print('No solution')
else:
	euler(start)