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 CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
int a[101][2];
int b[7];
int p[101][2];
bool v[101];
bool flag;
int n;
void dfs(int dep, int x, int y) {
  if (flag) return;
  v[x] = 1;
  p[dep][0] = x;
  p[dep][1] = y;
  if (dep == n) {
    flag = 1;
    return;
  }
  for (int i = 1; i <= n; i++) {
    if (!v[i]) {
      if (a[x][1 - y] == a[i][0])
        dfs(dep + 1, i, 0);
      else if (a[x][1 - y] == a[i][1])
        dfs(dep + 1, i, 1);
    }
  }
  v[x] = 0;
}
int main() {
  int i;
  cin >> n;
  for (i = 1; i <= n; i++) {
    scanf("%d%d", &a[i][0], &a[i][1]);
    b[a[i][0]]++;
    b[a[i][1]]++;
  }
  int qd = 0;
  for (i = 0; i <= 6; i++)
    if (b[i] % 2 == 1) qd++;
  if (qd != 0 && qd != 2)
    puts("No solution");
  else {
    memset(v, 0, sizeof(v));
    flag = 0;
    if (qd == 0)
      dfs(1, 1, 0);
    else {
      for (i = 1; i <= n; i++)
        if (b[a[i][0]] % 2 == 1) {
          dfs(1, i, 0);
          break;
        } else if (b[a[i][1]] % 2 == 1) {
          dfs(1, i, 1);
          break;
        }
    }
    if (!flag)
      puts("No solution");
    else {
      for (i = 1; i <= n; i++) {
        printf("%d ", p[i][0]);
        if (p[i][1] == 0)
          printf("+\n");
        else
          printf("-\n");
      }
    }
  }
  return 0;
}