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.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author ocelopilli
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }
}

class TaskB {
    int N;
    int[][] edge = new int[100][2];
    int[] deg = new int[ 7 ];
    int[] parent = new int[ 7 ];

    int find(int x)
    {
        return x == parent[x] ? x : (parent[x] = find( parent[x] ));
    }

    boolean [] seen = new boolean[100];
    void dfs(int x, int w, PrintWriter out)
    {
        seen[ x ] = true;
        for (int i=0; i<N; i++)
        {
            if ( seen[i] == true ) continue;
            for (int j=0; j<2; j++)
            {
                if ( edge[x][(w+1)%2] == edge[i][j] )
                {
                    dfs( i, j, out );
                    break;
                }
            }
        }
        out.println( (x+1)+" "+(w == 1 ? "+" : "-") );
    }

    public void solve(int testNumber, InputReader in, PrintWriter out) {
        N = in.nextInt();

        for (int i=0; i<N; i++)
        {
            for (int j=0; j<2; j++)
            {
                edge[i][j] = in.nextInt();
                deg[ edge[i][j] ]++;
            }
        }

        int trees = 0;
        int oddCnt = 0;
        for (int x : deg)
        {
            if ( x % 2 == 1 ) oddCnt++;
            if ( x != 0 ) trees++;
        }

        for (int i=0; i<7; i++) parent[i] = i;
        for (int i=0; i<N; i++)
        {
            if ( find(edge[i][0]) != find(edge[i][1]) )
            {
                trees--;
                parent[ find(edge[i][0]) ] = find(edge[i][1]);
            }
        }

        if ( trees==1 )
        {
            if ( oddCnt == 0 || oddCnt == 2 )
            {
                for (int i=0; i<N; i++)
                {
                    for (int j=0; j<2; j++)
                    {
                        if ( deg[edge[i][j]] % 2 == 1 )
                        {
                            dfs( i, j, out );
                            return;
                        }
                    }
                }
                dfs( 0, 0, out );
            }
            else out.println("No solution");
        }
        else out.println("No solution");
    }
}

class InputReader {
    BufferedReader br;
    StringTokenizer st;

    public InputReader(InputStream in)
    {
        br = new BufferedReader(new InputStreamReader(in));
        st = null;
    }

    public String next()
    {
        while (st==null || !st.hasMoreTokens())
        {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return st.nextToken();
    }

    public int nextInt()
    {
        return Integer.parseInt(next());
    }

    }