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[7][7][101];
int d[101], t[7];
char cd[101];
bool dfs(int now, int saw, int n) {
  if (saw == n) return true;
  for (int i = 0; i < 7; i++)
    if (a[now][i][0] > 0) {
      d[saw] = a[now][i][a[now][i][0]];
      cd[saw] = '+';
      a[now][i][0]--;
      if (dfs(i, saw + 1, n)) return true;
      a[now][i][0]++;
    }
  for (int i = 0; i < 7; i++)
    if (a[i][now][0] > 0) {
      d[saw] = a[i][now][a[i][now][0]];
      cd[saw] = '-';
      a[i][now][0]--;
      if (dfs(i, saw + 1, n)) return true;
      a[i][now][0]++;
    }
  return false;
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int v1, v2;
    cin >> v1 >> v2;
    a[v1][v2][0]++;
    a[v1][v2][a[v1][v2][0]] = i + 1;
    t[v1]++;
    t[v2]++;
  }
  int odd1 = -1, odd2 = -1;
  for (int i = 0; i < 7; i++)
    if (t[i] % 2 == 1) {
      if (odd2 != -1) {
        cout << "No solution\n";
        return 0;
      } else if (odd1 == -1)
        odd1 = i;
      else
        odd2 = i;
    }
  if (odd1 != -1 && odd2 == -1) {
    cout << "No solution\n";
    return 0;
  }
  if (odd1 != -1) {
    if (dfs(odd1, 0, n)) {
      for (int i = 0; i < n; i++) cout << d[i] << ' ' << cd[i] << endl;
      return 0;
    } else {
      cout << "No solution\n";
      return 0;
    }
  } else {
    for (int i = 0; i < 7; i++)
      if (t[i] > 0) {
        if (dfs(i, 0, n)) {
          for (int j = 0; j < n; j++) cout << d[j] << ' ' << cd[j] << endl;
          return 0;
        } else {
          cout << "No solution\n";
          return 0;
        }
      }
    cout << "No solution\n";
    return 0;
  }
  return 0;
}