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.io.*;
import java.util.*;

public class B267 implements Runnable {

	final int n = 7;
	
	private void Solution() throws IOException {
		int[][] g = new int[n][n];
		ArrayList<Integer>[][] res = new ArrayList[n][n];
		for (int i = 0; i < n; i++)
			for (int j = 0; j < n; j++)
				res[i][j] = new ArrayList<Integer>(0);
		
		int m = nextInt();
		for (int i = 0; i < m; i++) {
			int x = nextInt(), y = nextInt();
			g[x][y]++;
			g[y][x]++;
			res[x][y].add(i + 1);
		}
		
		int[] pow = new int[n];
		for (int i = 0; i < n; i++)
			for (int j = 0; j < n; j++)
				pow[i] += g[i][j];
		
		boolean bad = false;
		int v = -1, u = -1;
		for (int i = 0; i < n; i++)
			if (pow[i] % 2 == 1)
				if (v == -1)
					v = i; else if (u == -1)
						u = i; else bad = true;
		
		if (v != -1) {
			g[v][u]++;
			g[u][v]++;
		}
		
		ArrayList<Integer> ans = new ArrayList<Integer>();
		int first = 0;
		while (pow[first] == 0) first++;
		Stack<Integer> s = new Stack<Integer>();
		s.add(first);
		while (!s.isEmpty()) {
			int cur = s.peek(), i = 0;
			for (; i < n; i++)
				if (g[cur][i] != 0)
					break;
			if (i == n) {
				s.pop();
				ans.add(cur);
			} else {
				g[i][cur]--;
				g[cur][i]--;
				s.add(i);
			}
		}
		for (int i = 0; i < n; i++)
			for (int j = 0; j < n; j++)
				if (g[i][j] != 0)
					bad = true;
		if (bad) {
			print("No solution");
			return;
		}
		if (v != -1) {
			for (int i = 0; i < ans.size() - 1; i++) {
				if (ans.get(i) == v && ans.get(i + 1) == u || ans.get(i) == u && ans.get(i + 1) == v) {
					ArrayList<Integer> tmp = new ArrayList<Integer>();
					for (int j = i + 1; j < ans.size(); j++)
						tmp.add(ans.get(j));
					for (int j = 1; j <= i; j++)
						tmp.add(ans.get(j));
					ans = tmp;
					break;
				}
			}
		}
		int[][] p = new int[n][n];
		for (int i = 0; i < ans.size() - 1; i++) {
			int x = ans.get(i), y = ans.get(i + 1);
			if (p[x][y] == res[x][y].size())
				println(res[y][x].get(p[y][x]++), '-'); else
					println(res[x][y].get(p[x][y]++), '+');
		}
	}

	public static void main(String[] args) {
		new B267().run();
	}

	BufferedReader in;
	PrintWriter out;
	StringTokenizer tokenizer;

	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			Solution();
			out.close();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(261);
		}
	}

	void halt() {
		out.close();
		System.exit(0);
	}

	long totalMemory() {
		return Runtime.getRuntime().totalMemory();
	}

	long freeMemory() {
		return Runtime.getRuntime().freeMemory();
	}

	void print(Object... obj) {
		for (int i = 0; i < obj.length; i++) {
			if (i != 0)
				out.print(" ");
			out.print(obj[i]);
		}
	}

	void println(Object... obj) {
		print(obj);
		out.println();
	}

	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	long nextLong() throws NumberFormatException, IOException {
		return Long.parseLong(nextToken());
	}

	double nextDouble() throws NumberFormatException, IOException {
		return Double.parseDouble(nextToken());
	}

	String nextLine() throws IOException {
		return in.readLine();
	}

	String nextToken() throws IOException {
		while (tokenizer == null || !tokenizer.hasMoreTokens())
			tokenizer = new StringTokenizer(nextLine());
		return tokenizer.nextToken();
	}
}