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 MAX = 500007, N = 120;
long long int odd, a[N][N], size[N], b[N][3], x, y, n, times[N], pointer;
vector<int> od, c, even, ans1, ans2;
stack<int> q;
bool op[N];
void DFS(int s) {
  if (!q.size()) {
    q.push(s);
  }
  long long int help;
  bool is = false;
  for (int i = 0; i <= n + 6; i++) {
    if (a[s][i]) {
      q.push(i);
      a[s][i]--;
      a[i][s]--;
      is = true;
      help = i;
      size[s]--;
      size[i]--;
      break;
    }
  }
  if (is) {
    DFS(help);
  } else {
    while (q.size()) {
      if (size[q.top()]) {
        DFS(q.top());
        break;
      } else {
        c.push_back(q.top());
        q.pop();
        if (!q.size()) return;
      }
    }
  }
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> x >> y;
    b[i + 6][1] = x;
    b[i + 6][2] = y;
    a[i + 6][x]++;
    a[i + 6][y]++;
    a[x][i + 6]++;
    a[y][i + 6]++;
    size[i + 6] += 2;
    size[x]++;
    size[y]++;
  }
  for (int i = 0; i < 7; i++) {
    if (size[i] % 2) {
      odd++;
      od.push_back(i);
    } else {
      if (size[i]) even.push_back(i);
    }
  }
  if (odd > 2) {
    cout << "No solution\n";
  } else {
    long long int startt;
    if (odd) {
      DFS(od[0]);
    } else {
      DFS(even[0]);
    }
    for (int i = 0; i < c.size(); i++) {
      if (c[i] > 6) {
        if (!times[c[i]]) {
          pointer++;
          times[c[i]] = pointer;
          ans1.push_back(c[i] - 6);
          if (i < c.size() - 1) {
            if (c[i + 1] != b[c[i]][2]) {
              ans2.push_back(1);
            } else {
              ans2.push_back(0);
            }
          } else {
            if (c[i - 1] != b[c[i]][1]) {
              ans2.push_back(1);
            } else {
              ans2.push_back(0);
            }
          }
        }
      }
    }
    if (pointer == n) {
      for (int i = 1; i <= n; i++) {
        cout << ans1[i - 1] << " ";
        if (ans2[i - 1]) {
          cout << "-\n";
        } else {
          cout << "+\n";
        }
      }
    } else {
      cout << "No solution\n";
    }
  }
  return 0;
}