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.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.StringTokenizer;


public class B {
    
    static StringTokenizer st;
    static BufferedReader in;
    static int[][]g;
    static ArrayList<Integer> List;
    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        int n = nextInt();
        g = new int[7][7];
        int[]a = new int[n+1], b = new int[n+1];
        for (int i = 1; i <= n; i++) {
            a[i] = nextInt();
            b[i] = nextInt();
            g[a[i]][b[i]]++;
            g[b[i]][a[i]]++;
        }
        int v1 = -1, v2 = -1;
        int firs = 0;
        for (int i = 0; i <= 6; i++) {
            int sum = 0;
            for (int j = 0; j <= 6; j++) {
                sum += g[i][j];
            }
            if (sum % 2==1) {
                if (v1==-1)
                    v1 = i;
                else if (v2==-1)
                    v2 = i;
                else {
                    System.out.println("No solution");
                    return;
                }
            }
            if (sum != 0)
                firs = i;
        }
        if (v1 != -1 && v2==-1) {
            System.out.println("No solution");
            return;
        }
        List = new ArrayList<Integer>();
        if (v1 != -1) {
            g[v1][v2]++;
            g[v2][v1]++;
        }
        euler(firs);
        if (v1 != -1) {
            ArrayList<Integer> List2 = new ArrayList<Integer>();
            for (int i = 0; i < List.size()-1; i++) {
                if (List.get(i)==v1 && List.get(i+1)==v2 || List.get(i)==v2 && List.get(i+1)==v1) {
                    for (int j = i+1; j < List.size(); j++) {
                        List2.add(List.get(j));
                    }
                    for (int j = 1; j <= i; j++) {
                        List2.add(List.get(j));
                    }
                    break;
                }
            }
            List.clear();
            List.addAll(List2);
        }
        for (int i = 0; i <= 6; i++) {
            for (int j = 0; j <= 6; j++) {
                if (g[i][j] > 0) {
                    System.out.println("No solution");
                    return;
                }
            }
        }
        boolean[]used = new boolean[n+1];
        for (int i = 0; i < List.size()-1; i++) {
            v1 = List.get(i);
            v2 = List.get(i+1);
            for (int j = 1; j <= n; j++) {
                if (!used[j] && (v1==a[j] && v2==b[j] || v1==b[j] && v2==a[j])) {
                    System.out.print(j+" ");
                    if (v1==a[j] && v2==b[j])
                        System.out.println("+");
                    else
                        System.out.println("-");
                    used[j] = true;
                    break;
                }
            }
        }
        pw.close();
    }
    private static void euler(int v) {
        int to = -1;
        List.add(v);
        for (int i = 0; i <= 6; i++) {
            if (g[v][i] > 0) {
                to = i;
                break;
            }
        }
        if (to != -1) {
            g[v][to]--;
            g[to][v]--;
            euler(to);
        }
    }
    private static int nextInt() throws IOException{
        return Integer.parseInt(next());
    }
    
    private static long nextLong() throws IOException{
        return Long.parseLong(next());
    }
    
    private static double nextDouble() throws IOException{
        return Double.parseDouble(next());
    }
    
    private static String next() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }
}