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;
list<int> ciclo;
vector<pair<int, int> > adj[7];
void dfs(list<int>::iterator it, int u) {
  it = ciclo.insert(it, u);
  for (int j = 0; j < (int)adj[u].size(); ++j) {
    pair<int, int> &v = adj[u][j];
    if (v.second) {
      v.second = 0;
      for (int k = 0; k < (int)adj[v.first].size(); ++k) {
        pair<int, int> &other = adj[v.first][k];
        if (other.first == u && other.second) {
          other.second = 0;
          break;
        }
      }
      dfs(it, v.first);
    }
  }
}
int x[105], y[105];
int deg[7];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d %d", &x[i], &y[i]);
    adj[x[i]].push_back(pair<int, int>(y[i], 1));
    adj[y[i]].push_back(pair<int, int>(x[i], 1));
    deg[x[i]]++;
    deg[y[i]]++;
  }
  int even = 0, odd = 0, start = 0;
  for (int i = 0; i < 7; ++i) {
    if (deg[i] == 0) continue;
    if (deg[i] & 1)
      odd++, start = i;
    else
      even++;
  }
  if (odd != 0 && odd != 2) {
    puts("No solution");
    return 0;
  }
  if (odd == 0) {
    for (int i = 0; i < 7; ++i)
      if (deg[i]) start = i;
  }
  dfs(ciclo.begin(), start);
  vector<int> sol(ciclo.begin(), ciclo.end());
  vector<pair<int, int> > answer;
  int prev;
  for (int i = 0; i < (int)sol.size(); ++i) {
    if (i == 0) {
      prev = sol[i];
      continue;
    }
    int current = sol[i];
    for (int rep = 0; rep < n; ++rep) {
      if (x[rep] == -1 || y[rep] == -1) continue;
      if (prev == x[rep] && current == y[rep]) {
        answer.push_back(pair<int, int>(rep + 1, 0));
        x[rep] = y[rep] = -1;
        break;
      } else if (prev == y[rep] && current == x[rep]) {
        answer.push_back(pair<int, int>(rep + 1, 1));
        x[rep] = y[rep] = -1;
        break;
      }
    }
    prev = current;
  }
  if (answer.size() != n) {
    puts("No solution");
  } else {
    for (int i = 0; i < n; ++i)
      printf("%d %c\n", answer[i].first, answer[i].second == 0 ? '+' : '-');
  }
  return 0;
}