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, b, c, d, e, u[8];
vector<pair<int, int> > v[109];
bool bo[109], boo[109];
void dfs(int q) {
  for (vector<pair<int, int> >::iterator it = v[q].begin(); it != v[q].end();
       it++) {
    if (bo[abs((*it).second)] == 1) continue;
    bo[abs((*it).second)] = 1;
    dfs(abs((*it).first));
    if ((*it).second >= 0)
      cout << (*it).second << " -" << endl;
    else
      cout << -(*it).second << " +" << endl;
  }
}
void dfs2(int q) {
  boo[q] = 1;
  for (vector<pair<int, int> >::iterator it = v[q].begin(); it != v[q].end();
       it++) {
    if (boo[(*it).first] == 1) continue;
    boo[(*it).first] = 1;
    dfs2((*it).first);
  }
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> a;
  for (b = 1; b <= a; b++) {
    cin >> c >> d;
    v[c].push_back(make_pair(d, b));
    v[d].push_back(make_pair(c, -b));
    u[c]++;
    u[d]++;
  }
  c = 0;
  d = -1;
  e = 0;
  for (b = 0; b <= 6; b++) {
    if (u[b] % 2 == 1) {
      c++;
      if (c > 2) break;
      if (c == 1)
        d = b;
      else
        e = b;
    } else {
      if (d == -1 && u[b] != 0) d = b;
    }
  }
  if (c > 2) {
    cout << "No solution";
    return 0;
  }
  dfs2(d);
  for (b = 0; b <= 6; b++) {
    if (u[b] > 0 && boo[b] == 0) {
      cout << "No solution";
      return 0;
    }
  }
  dfs(d);
  return 0;
}