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.ArrayDeque;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.StringTokenizer;

public class Solution {
    //<editor-fold desc="input parse" defaultstate="collapsed">

    private static StringTokenizer st;
    private static java.io.BufferedReader reader;
    private static java.io.BufferedWriter writer;

    private static long nextLong() {
        return Long.parseLong(st.nextToken());
    }

    private static int nextInt() {
        return Integer.parseInt(st.nextToken());
    }

    private static double nextDouble() {
        return Double.parseDouble(st.nextToken());
    }

    private static short nextShort() {
        return Short.parseShort(st.nextToken());
    }

    private static byte nextByte() {
        return Byte.parseByte(st.nextToken());
    }

    private static void initTokenizer() throws Exception {
        st = new StringTokenizer(reader.readLine());
    }

    //</editor-fold>
    
    public static void main(String[] args) throws Exception {
	reader = new java.io.BufferedReader(new java.io.InputStreamReader(System.in), 1 << 20);
	writer = new java.io.BufferedWriter(new java.io.OutputStreamWriter(System.out));
	//reader = new java.io.BufferedReader(new java.io.FileReader("input.txt"), 1 << 20);
	//writer = new java.io.BufferedWriter(new java.io.FileWriter("output.txt"));
	
	initTokenizer();
	
	int n = 7;
	int m = nextInt();
	
	ArrayDeque<Integer> edgeIDs[][] = new ArrayDeque[n][n];
	
	for (int i = 0; i < n; i++) {
	    for (int j = 0; j < n; j++) {
		edgeIDs[i][j] = new ArrayDeque<>();
	    }
	}
	
	int[][] g = new int[n][n];
	
	int[] power = new int[n];
	
	for (int i = 1; i <= m; i++) {
	    initTokenizer();
	    
	    int a = nextInt();
	    int b = nextInt();
	    
	    g[a][b]++;
	    g[b][a]++;
	    
	    power[a]++;
	    power[b]++;
	    
	    edgeIDs[a][b].add(i);
	    edgeIDs[b][a].add(-i);
	}
	
	int invalid1 = -1;
	int invalid2 = -1;
	
	for (int i = 0; i < n; i++) {
	    int edges = 0;
	    
	    for (int j = 0; j < n; j++) edges += g[i][j];
	    
	    if ((edges & 1) == 1) {
		if (invalid1 == -1) invalid1 = i;
		else if (invalid2 != -1) {
		    System.out.println("No solution");
		    return;
		}
		else {
		    invalid2 = i;
		    
		    g[invalid1][invalid2]++;
		    g[invalid2][invalid1]++;
		    
		    power[invalid1]++;
		    power[invalid2]++;
		}
	    }
	}
	
	ArrayDeque<Integer> traversal = new ArrayDeque<>();
	ArrayList<Integer> path = new ArrayList<>(m);
	
	for (int i = 0; i < n; i++)
	    if (power[i] != 0) {
		traversal.add(i);
		break;
	    }
	
	while (!traversal.isEmpty()) {
	    int top = traversal.getLast();
	    
	    if (power[top] == 0) {
		path.add(top);
		traversal.pollLast();
	    }
	    else {
		for (int i = 0; i < n; i++) {
		    if (g[top][i] != 0) {
			traversal.addLast(i);
			power[i]--;
			power[top]--;
			g[top][i]--;
			g[i][top]--;
			break;
		    }
		}
	    }
	}
	
	for (int i = 0; i < n; i++)
	    if (power[i] != 0) {
		System.out.println("No solution");
		return;
	    }
	
	if (invalid1 != -1) {
	    for (int i = 1; i < path.size(); i++) {
		if ((path.get(i) == invalid1 && path.get(i - 1) == invalid2) ||
		    (path.get(i) == invalid2 && path.get(i - 1) == invalid1)) {
		    ArrayList<Integer> path2 = new ArrayList<>(path.size());
		    
		    path2.addAll(path.subList(i, path.size()));
		    path2.addAll(path.subList(1, i));
		    path = path2;
		    break;
		}
	    }
	}
	
	for (int i = 1; i < path.size(); i++) {
	    int v1 = path.get(i - 1);
	    int v2 = path.get(i);
	    
	    int edgeID = edgeIDs[v1][v2].pollLast();
	    edgeIDs[v2][v1].pollLast();
	    
	    writer.write(String.format("%s %s", Math.abs(edgeID), edgeID > 0 ? "+" : "-"));
	    writer.newLine();
	}
	
	writer.close();
    }
}