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 h[7], s[110], c, m[7][7], p[110], u[7];
vector<int> v[7][7];
void dfs(int i) {
  int j;
  u[i] = 1;
  for (j = 0; j < 7; j++)
    if (m[i][j]) {
      m[i][j]--;
      m[j][i]--;
      dfs(j);
    }
  s[c++] = i;
}
int main() {
  int i, n, j, k;
  for (scanf("%d", &n), k = 1; k <= n; k++) {
    scanf("%d%d", &i, &j);
    if (i <= j)
      v[i][j].push_back(k);
    else
      v[j][i].push_back(-k);
    h[i]++;
    h[j]++;
    m[i][j]++;
    m[j][i]++;
  }
  for (j = 0, i = 0; i < 7; j += h[i] % 2, i++)
    ;
  if (j > 2) {
    printf("No solution\n");
    return 0;
  }
  for (i = 0; i < 7 && h[i] % 2 == 0; i++)
    ;
  for (j = i + 1; j < 7 && h[j] % 2 == 0; j++)
    ;
  if (i < 7) {
    v[i][j].push_back(n + 1);
    m[i][j]++;
    m[j][i]++;
  }
  for (j = 0, i = 0; i < 7; i++)
    if (!u[i] && h[i]) {
      dfs(i);
      j++;
    }
  if (j > 1) {
    printf("No solution\n");
    return 0;
  }
  for (i = 0; i < c - 1; i++)
    if (s[i] < s[i + 1]) {
      p[i] = v[s[i]][s[i + 1]].back();
      v[s[i]][s[i + 1]].pop_back();
    } else {
      p[i] = -v[s[i + 1]][s[i]].back();
      v[s[i + 1]][s[i]].pop_back();
    }
  for (i = 0; i < c - 1 && p[i] != n + 1 && p[i] != -n - 1; i++)
    ;
  if (i < c - 1) i++;
  for (i %= c - 1, j = 0; j < n; i++, i %= c - 1, j++)
    if (p[i] > 0)
      printf("%d +\n", p[i]);
    else
      printf("%d -\n", -p[i]);
  return 0;
}