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 sgu101 { 
    static ArrayDeque<Integer> tour; 
    static int[][] g; 
    public static void main(String[] args) { 
        Scanner in = new Scanner(System.in); 
        int n = in.nextInt(); 
        int[] degree = new int[7]; 
        int[] start = new int[n]; 
        int[] end = new int[n]; 
        g = new int[7][7]; 
        for(int i=0; i<n; i++) { 
            int a = in.nextInt(); 
            int b = in.nextInt(); 
            degree[a]++; 
            degree[b]++; 
            start[i]=a; 
            end[i]=b; 
            g[a][b]++; 
            g[b][a]++; 
        } 
        int first = -1; 
        for(int i=0; i<7; i++) 
            if(degree[i] % 2 == 1) 
                first = i; 
        if(first == -1) 
            for(int i=0; i<7; i++) 
                if(degree[i] > 0) 
                    first = i; 
          
        tour = new ArrayDeque<Integer>(); 
        findTour(first); 
          
        int cur = tour.poll(); 
        boolean ok = true; 
        ArrayList<String> ans = new ArrayList<String>(); 
        for(int i=0; i<n; i++) { 
            boolean found = false; 
            if(tour.size() == 0) { 
                ok = false; 
                break; 
            } 
            int next = tour.poll(); 
              
            for(int j=0; !found && j<n; j++) { 
                if(start[j] == cur && end[j] == next) { 
                    found = true; 
                    start[j] = end[j] = -1; 
                    ans.add((j+1)+" +"); 
                } 
                else if(start[j] == next && end[j] == cur) { 
                    found = true; 
                    start[j] = end[j] = -1; 
                    ans.add((j+1)+" -"); 
                } 
            } 
              
            if(!found) ok = false; 
            cur = next; 
        } 
        if(!ok) System.out.println("No solution"); 
        else { 
            for(String s : ans) 
                System.out.println(s); 
        } 
    } 
    static void findTour(int pos) { 
        for(int i=0; i<7; i++) { 
            if(g[pos][i] > 0) { 
                g[pos][i]--; 
                g[i][pos]--; 
                findTour(i); 
            } 
        } 
        tour.push(pos); 
    } 
}