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

public class Dominos {
    static int n;
    static boolean can;
    static int[] domino;
    static Point[] arr;

    public static void dfs(int x, int count, Point[] sol) {
        if (can)
            return;
        if (count == n) {
            can = true;
            print(sol);
            System.exit(0);
        }
        for (int j = 0; j < 49; j++) {
            if (domino[j] > 0) {
                int front = j / 7;
                if (front == x) {
                    domino[j]--;
                    domino[get(j)]--;
                    sol[count] = new Point(front, j % 7);
                    dfs(j % 7, count + 1, sol);
                    domino[get(j)]++;
                    domino[j]++;
                }
            }
        }
    }

    private static int get(int j) {
        int front = j / 7;
        int tail = j % 7;

        return tail * 7 + front;
    }

    private static void print(Point[] sol) {
        boolean[] vis = new boolean[n];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                if (vis[j])
                    continue;
                if (sol[i].x == arr[j].x && sol[i].y == arr[j].y) {
                    System.out.println((j + 1) + " +");
                    vis[j] = true;
                    break;
                }
                if (sol[i].x == arr[j].y && sol[i].y == arr[j].x) {
                    System.out.println((j + 1) + " -");
                    vis[j] = true;
                    break;
                }
            }
        }

    }

    public static void main(String[] args) {
        InputReader r = new InputReader(System.in);
        n = r.nextInt();
        arr = new Point[n];
        int[] deg = new int[7];
        for (int i = 0; i < arr.length; i++) {
            arr[i] = new Point(r.nextInt(), r.nextInt());
            deg[arr[i].x]++;
            deg[arr[i].y]++;
        }
        int odd = 0, index = -1;
        for (int i = 0; i < deg.length; i++) {
            if (deg[i] % 2 == 1) {
                odd++;
                index = i;
            }
        }
        domino = new int[49];
        for (int i = 0; i < arr.length; i++) {
            domino[arr[i].x * 7 + arr[i].y]++;
            domino[arr[i].y * 7 + arr[i].x]++;
        }
        if (index == -1) {
            index = arr[0].x;
        }
        if (odd > 2)
            System.out.println("No solution");
        else {
            Point[] sol = new Point[n];
            dfs(index,0,sol);
            System.out.println("No solution");
        }
    }

    static class InputReader {
        private BufferedReader reader;
        private StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

        public String nextLine() {
            try {
                return reader.readLine();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
                return null;
            }
        }

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

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

        public long nextLong() {
            return Long.parseLong(next());
        }
    }
}