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.*;

public class Solution {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        new Solution().solve(scanner);
    }
    class Edge{
        ArrayList<Integer> edgeIdx = new ArrayList<Integer>();
    }
    private void solve(Scanner scanner) {
        int nEdge = scanner.nextInt();
        Edge[][] g = new Edge[7][7];
        int[][] edgeList = new int[nEdge][2];
        for(int i = 0; i < nEdge; i++){
            int a = scanner.nextInt(); int b = scanner.nextInt();
            edgeList[i][0] = a; edgeList[i][1] = b;
            Edge e;
            if(g[a][b] == null){
                e = new Edge();
            }else{
                e = g[a][b];
            }
            e.edgeIdx.add(i);
            g[a][b] = e; g[b][a] = e;
        }
        boolean[] nodes = new boolean[7];
        int nNode = 0; int oddNode = 0;
        int start = -1;
        for(int i = 0; i < 7; i++){
            int degree = 0;
            for(int j = 0; j < 7; j++){
                if(g[i][j] == null) {
                    Edge e = new Edge();
                    g[i][j] = e; g[j][i] = e;
                }
                degree += i != j? g[i][j].edgeIdx.size() : g[i][j].edgeIdx.size()*2;
            }
            if(degree > 0) {
                nodes[i] = true;nNode++;
            }
            if(degree % 2 == 1){
                start = i;
                oddNode++;
            }
        }
        if(oddNode != 0 && oddNode != 2){
            System.out.println("No solution");
            return;
        }
        if(start < 0){
            for(int i = 0; i < 7; i++){
                if(nodes[i]){
                    start = i; break;
                }
            }
        }
        boolean[] visited = new boolean[7];
        connected(g, start, visited);
        if(Arrays.equals(visited, nodes)){
            find_euler(g, start, edgeList);
        }else {
            System.out.println("No solution");
        }
    }

    private void connected(Edge[][] g, int start, boolean[] visited) {
        if(!visited[start]){
            visited[start] = true;
            for(int i = 0; i < 7; i++){
                if(g[start][i].edgeIdx.size() > 0){
                    connected(g, i, visited);
                }
            }
        }
    }
    private void find_euler(Edge[][] g, int start, int[][] edgeList) {
        int candidate = -1;
        for(int next = 0; next < 7; next++){
            int edgeCount = g[start][next].edgeIdx.size();
            if((start == next ? edgeCount * 2 : edgeCount) > 1){
                candidate = next; break;
            }
            if(edgeCount == 1){
                candidate = next;
            }
        }
        if(candidate < 0) return;
        int ei = g[start][candidate].edgeIdx.get(0);
        if(start == edgeList[ei][0]){
            System.out.println((ei+1) + " +");
        }else{
            System.out.println((ei+1) + " -");
        }
        g[start][candidate].edgeIdx.remove(0);
        find_euler(g, candidate, edgeList);
    }
}