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;
struct Info {
  int Number;
  bool Flag;
};
struct Edge {
  int Data, Number;
};
vector<Info> Map[7][7];
vector<Edge> G[7];
bool Flag[100];
vector<int> List;
void DFS(int V) {
  for (int i = 0; i < G[V].size(); i++)
    if (!Flag[G[V][i].Number]) {
      Flag[G[V][i].Number] = true;
      DFS(G[V][i].Data);
    }
  List.push_back(V);
}
int main() {
  int M;
  scanf("%d", &M);
  static int Degree[7];
  memset(Degree, 0, sizeof(Degree));
  static bool Go[7][7];
  for (int i = 0; i <= 6; i++)
    for (int j = 0; j <= 6; j++) Go[i][j] = (i == j);
  for (int i = 0; i < M; i++) {
    int X, Y;
    scanf("%d%d", &X, &Y);
    Map[X][Y].push_back((Info){i, true});
    Map[Y][X].push_back((Info){i, false});
    G[X].push_back((Edge){Y, i});
    G[Y].push_back((Edge){X, i});
    Degree[X]++;
    Degree[Y]++;
    Go[X][Y] = Go[Y][X] = true;
  }
  int Count = 0;
  for (int i = 0; i <= 6; i++) Count += Degree[i] & 1;
  if (Count > 2) {
    printf("No solution\n");
    return 0;
  }
  for (int k = 0; k <= 6; k++)
    for (int i = 0; i <= 6; i++)
      for (int j = 0; j <= 6; j++)
        Go[i][j] = Go[i][j] || (Go[i][k] && Go[k][j]);
  for (int i = 0; i <= 6; i++)
    for (int j = 0; j <= 6; j++)
      if (Degree[i] && Degree[j] && !Go[i][j]) {
        printf("No solution\n");
        return 0;
      }
  int V = -1;
  for (int i = 0; i <= 6; i++) {
    if (Degree[i]) V = i;
    if (Degree[i] & 1) break;
  }
  memset(Flag, 0, sizeof(Flag));
  DFS(V);
  memset(Flag, 0, sizeof(Flag));
  for (int i = 1; i < List.size(); i++) {
    int X = List[i - 1], Y = List[i];
    for (int j = 0; j < Map[X][Y].size(); j++) {
      int V = Map[X][Y][j].Number;
      if (Flag[V]) continue;
      Flag[V] = true;
      printf("%d ", V + 1);
      putchar(Map[X][Y][j].Flag ? '+' : '-');
      putchar('\n');
      break;
    }
  }
  return 0;
}