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;
const int maxn = 200;
struct data {
  int v, num;
};
int n, d[maxn], e[maxn][2], s, tot;
bool used[maxn];
list<data> link[maxn];
list<int> ans;
void init() {
  scanf("%d", &n);
  int a, b;
  for (int i = 1; i <= n; ++i) {
    scanf("%d%d", &a, &b);
    data tmp;
    tmp.v = b;
    tmp.num = i;
    link[a].push_back(tmp);
    tmp.v = a;
    tmp.num = -i;
    link[b].push_back(tmp);
    ++d[a];
    ++d[b];
    s = a;
  }
}
int abs(int x) { return x > 0 ? x : -x; }
void dfs(int x) {
  list<data>::iterator p;
  p = link[x].begin();
  while (p != link[x].end()) {
    if (!used[abs(p->num)]) {
      used[abs(p->num)] = 1;
      dfs(p->v);
      ans.push_front(p->num);
      ++tot;
    }
    ++p;
  }
}
void print() {
  list<int>::iterator p;
  p = ans.begin();
  while (p != ans.end()) {
    printf("%d ", abs(*p));
    if (*p > 0)
      printf("+\n");
    else
      printf("-\n");
    ++p;
  }
}
void work() {
  int odds = 0;
  for (int i = 0; i <= 6; ++i)
    if (d[i] % 2 == 1) {
      s = i;
      ++odds;
    }
  if ((odds == 0) || (odds == 2)) {
    dfs(s);
    if (tot == n)
      print();
    else
      printf("No solution");
  } else
    printf("No solution");
}
int main() {
  init();
  work();
}