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 n, x, y, k;
int g[7][7] = {0};
int a[101];
int b[101][4] = {0}, l;
vector<int> mimdevroba;
char ch, ch1, ch2, ch3;
string t;
void gamotana(int z) {
  if (z < 10) {
    ch1 = z + '0';
    t = t + ch1;
    t = t + ' ';
  } else if (z < 100) {
    ch2 = (z % 10) + '0';
    ch1 = (z / 10) + '0';
    t = t + ch1 + ch2 + ' ';
  } else
    t = t + "100 ";
}
void EULER(int v) {
  for (int i = 0; i <= 6; i++)
    if (g[v][i] > 0) {
      g[v][i] = g[i][v] = g[i][v] - 1;
      EULER(i);
    }
  mimdevroba.push_back(v);
}
int main() {
  int s;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> x >> y;
    b[i][1] = x;
    b[i][2] = y;
    l = x;
    g[x][y] = g[y][x] = g[y][x] + 1;
  }
  for (int i = 0; i <= 6; i++) {
    int s = 0;
    for (int j = 1; j <= n; j++)
      for (int d = 1; d <= 2; d++)
        if (b[j][d] == i) s++;
    a[i] = s;
  }
  s = 0;
  k = l;
  for (int i = 0; i <= 6; i++)
    if (a[i] % 2 == 1) {
      s++;
      if (k == l) k = i;
    }
  if (s > 2 || s == 1) {
    cout << "No solution";
    return 0;
  }
  EULER(k);
  for (int i = 0; i <= 6; i++)
    for (int j = 0; j <= 6; j++)
      if (g[i][j] == 1) {
        cout << "No solution";
        return 0;
      }
  t = "";
  s = 0;
  for (int i = mimdevroba.size() - 1; i > 0; i--) {
    x = mimdevroba[i];
    y = mimdevroba[i - 1];
    for (int j = 1; j <= n; j++)
      if (b[j][1] == x && b[j][2] == y && b[j][3] == 0) {
        gamotana(j);
        t = t + "+";
        s++;
        b[j][3] = 1;
        break;
      } else if (b[j][1] == y && b[j][2] == x && b[j][3] == 0) {
        gamotana(j);
        t = t + "-";
        s++;
        b[j][3] = 1;
        break;
      }
  }
  int f = 0;
  f = t.length();
  if (s != n) {
    cout << "No solution";
    return 0;
  }
  f = 0;
  while (f < t.length()) {
    cout << t[f];
    if (t[f] == '+' || t[f] == '-') cout << endl;
    f = f + 1;
  }
  return 0;
}