Problem: 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 -

Solution (in JAVA):

Solution:
import java.util.*;
import java.io.*;

public class Hierholzer {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));
		int m = Integer.parseInt(br.readLine());
		List<Edge> graph[] = new List[7];
		for (int i = 0; i < graph.length; ++i)
			graph[i] = new ArrayList<>();
		Stack<Edge> edges[][] = new Stack[7][7];
		for (int i = 0; i < edges.length; ++i) {
			for (int j = 0; j < edges.length; ++j) {
				edges[i][j] = new Stack<>();
			}
		}
		for (int i = 0; i < m; ++i) {
			String[] sp = br.readLine().split(" ");
			int a = Integer.parseInt(sp[0]);
			int b = Integer.parseInt(sp[1]);
			Edge e = new Edge(a, b, i);
			graph[a].add(e);
			graph[b].add(e);
			edges[a][b].push(e);
			edges[b][a].push(e);
		}
		List<Integer> euler = hierholzer(graph);
		if (euler == null)
			pw.println("No solution");
		else {
			for (int i = 1; i < euler.size(); ++i) {
				int u = euler.get(i - 1);
				int v = euler.get(i);
				Edge e = null;
				while (!(e = edges[u][v].pop()).used);
				pw.println((e.id + 1) + (e.u == u ? " +" : " -"));
				e.used = false;
			}
		}
		// pw.println(euler == null ? "null" : euler.toString());
		pw.close();
	}
	static class Edge {
		public int u, v, id;
		public boolean used = false;
		public Edge(int U, int V, int ID) { u = U; v = V; id = ID; }
		public int other(int a) { return a == u ? v : u; }
	}
	static List<Integer> hierholzer(List<Edge> graph[]) {
		int odd = 0, start = 0, n = graph.length;
		int[] edge = new int[n];
		for (int i = 0; i < n; ++i)
			if (graph[i].size() > 0)
				{ start = i; break; }
		for (int i = 0; i < n; i++)
			if (graph[i].size() % 2 == 1) {
				odd++;
				start = i;
			}
		if (odd != 0 && odd != 2) return null; // no path
		List<Integer> path = new ArrayList<>();
		Stack<Integer> stack = new Stack<>();
		stack.push(start);
		while (!stack.isEmpty()) {
			int v = stack.pop();
			while (edge[v] < graph[v].size()) {
				Edge e = graph[v].get(edge[v]++);
				if (e.used) continue;
				stack.push(v);
				v = e.other(v);
				e.used = true;
			}
			path.add(v);
		}
		for (int i = 0; i < graph.length; ++i)
			if (edge[i] < graph[i].size())
				return null; // not connected
		return path;
	}

}