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:

//package B;

import java.util.ArrayList;
import java.util.Scanner;

public class Solution { 
    ArrayList e[][] = new ArrayList[7][7];    
    ArrayList<Integer> order = new ArrayList<>();
    int[][] a = new int[7][7];
    int[][] pos = new int[7][7];
    int[] deg = new int[7];
    
    void imp() {
        System.out.println("No solution");
        System.exit(0);
    }
    
    void dfs(int u) {
        for (int i = 0; i <= 6; ++i) if (a[u][i] > 0) {
            --a[u][i];
            --a[i][u];
            dfs(i);
        }
        order.add(u);
    }
    
    void print(int x, int y) {
        if (pos[x][y] < e[x][y].size()) {
            int p = pos[x][y]++;
            int s = (Integer)e[x][y].get(p);                       
            System.out.println((s + 1) + " +");
        }
        else {
            int p = pos[y][x]++;
            int s = (Integer)e[y][x].get(p);
            System.out.println((s + 1) + " -");
        }
    }
    
    void run() throws Exception {
        Scanner in = new Scanner(System.in);
        for (int i = 0; i <= 6; ++i)
            for (int j = 0; j <= 6; ++j)
                e[i][j] = new ArrayList<>();
        int n = in.nextInt();
        for (int i = 0; i < n; ++i) {
            int x = in.nextInt();
            int y = in.nextInt();
            ++deg[x];
            ++deg[y];
            ++a[x][y];
            ++a[y][x];
            e[x][y].add(i);
        }
        int k = 0;
        for (int i = 0; i <= 6; ++i)
            k += deg[i] % 2;
        
        int s = 0;
        while (deg[s] == 0)
            ++s;
        
        if (k != 0 && k != 2)
            imp();
        else if (k == 2) {
            for (int i = 0; i <= 6; ++i) if (deg[i] % 2 == 1)
                s = i;
        }
        dfs(s);
        if (order.size() != n + 1)
            imp();
        
        for (int i = n; i > 0; --i) {
            int x = order.get(i);
            int y = order.get(i - 1);
            print(x, y);
        }
    }
    public static void main(String args[]) throws Exception {
        new Solution().run();
    }
}