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 MAXN = 1e2 + 10;
bool visited[MAXN];
int yals[MAXN][2];
int n;
vector<pair<int, int> > graph[7];
vector<pair<int, char> > ans2;
int dfs(int u, int id) {
  while (!graph[u].empty()) {
    int p = graph[u].back().first;
    int e = graph[u].back().second;
    graph[u].pop_back();
    if (!visited[e]) {
      visited[e] = 1;
      dfs(p, e);
    }
  }
  if (id != -1 && id < n) {
    int s = id + 1;
    char p;
    if (yals[id][1] == u) {
      p = '-';
    } else {
      p = '+';
    }
    ans2.push_back({s, p});
  }
}
int main() {
  cin >> n;
  if (n == 1) {
    cout << 1 << ' ' << '+' << endl;
    return 0;
  }
  int a, b;
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    a;
    b;
    yals[i][0] = a;
    yals[i][1] = b;
    graph[a].push_back({b, i});
    graph[b].push_back({a, i});
  }
  int last = -1;
  int siz = 0;
  int m = n;
  for (int i = 0; i <= 6; i++) {
    if (graph[i].size() % 2) {
      siz++;
      if (siz > 2) {
        cout << "No solution" << endl;
        return 0;
      }
      if (last == -1) {
        last = i;
      } else {
        graph[last].push_back({i, m});
        graph[i].push_back({last, m});
        m++;
      }
    }
  }
  if (last != -1) {
    dfs(last, -1);
  } else {
    dfs(yals[0][0], -1);
  }
  for (int i = 0; i <= 6; i++) {
    if (graph[i].size()) {
      cout << "No solution" << endl;
      return 0;
    }
  }
  for (int i = 0; i < n; i++) {
    cout << ans2[i].first << ' ' << ans2[i].second << endl;
  }
}