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;
pair<int, int> E[104];
bool mark[104], visited[7];
int a[7][7], deg[7];
vector<int> path;
void DFS(int V) {
  int count = 1;
  visited[V] = true;
  for (int i = 0; i < 7; i++)
    if (!visited[i] && a[V][i]) DFS(i);
}
bool can_go(int u, int v) {
  if (!a[u][v]) return false;
  if (deg[u] == 1) return true;
  int cc1 = 0, cc2 = 0;
  for (int i = 0; i < 7; i++) visited[i] = false;
  for (int i = 0; i < 7; i++)
    if (!visited[i]) {
      DFS(i);
      cc1++;
    }
  a[u][v]--;
  a[v][u]--;
  for (int i = 0; i < 7; i++) visited[i] = false;
  for (int i = 0; i < 7; i++)
    if (!visited[i]) {
      DFS(i);
      cc2++;
    }
  a[u][v]++;
  a[v][u]++;
  if (cc1 != cc2) return false;
  return true;
}
void find_path(int V) {
  bool ch = false;
  for (int i = 0; i < 7; i++) {
    if (can_go(V, i)) {
      deg[V]--;
      deg[i]--;
      a[V][i]--;
      a[i][V]--;
      path.push_back(V);
      path.push_back(i);
      find_path(i);
      ch = true;
      break;
    }
  }
  if (!ch)
    for (int i = 0; i < 7; i++)
      if (a[V][i]) {
        a[V][i]--;
        a[i][V]--;
        path.push_back(V);
        path.push_back(i);
        deg[V]--;
        deg[i]--;
        find_path(i);
        break;
      }
}
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int aa, bb;
    cin >> aa >> bb;
    a[aa][bb]++;
    a[bb][aa]++;
    deg[aa]++;
    deg[bb]++;
    E[i] = make_pair(aa, bb);
  }
  int cc = 0, start_vert = -1;
  for (int i = 0; i < 7; i++)
    if (deg[i] % 2) {
      cc++;
      start_vert = i;
    }
  if (cc != 0 && cc != 2) {
    cout << "No solution" << endl;
    return 0;
  }
  DFS(E[1].first);
  for (int i = 0; i < 7; i++)
    if (!visited[i] && deg[i]) {
      cout << "No solution" << endl;
      return 0;
    }
  if (start_vert == -1) start_vert = E[1].first;
  find_path(start_vert);
  cout << endl;
  for (int i = 0; i < path.size(); i += 2)
    for (int j = 1; j <= n; j++) {
      if (!mark[j])
        if (path[i] == E[j].first && path[i + 1] == E[j].second) {
          cout << j << " +" << endl;
          mark[j] = true;
          break;
        } else if (path[i + 1] == E[j].first && path[i] == E[j].second) {
          mark[j] = true;
          cout << j << " -" << endl;
          break;
        }
    }
  return 0;
}