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 deg[7], nodes[7], from[200], to[200], ne;
vector<int> edges[7][7];
stack<int> ss;
vector<int> vec;
bool vis[200];
void addEdge(int f, int t) {
  from[ne] = nodes[f];
  nodes[f] = ne;
  to[ne] = t;
  ne++;
  from[ne] = nodes[t];
  nodes[t] = ne;
  to[ne] = f;
  ne++;
}
void trace(int cn) {
  if (deg[cn]) {
    ss.push(cn);
    int counter = 0;
    for (int k = nodes[cn]; k != -1; k = from[k]) {
      counter++;
      if (!vis[k]) {
        vis[k] = 1;
        vis[k ^ 1] = 1;
        deg[cn]--;
        deg[to[k]]--;
        trace(to[k]);
        break;
      }
    }
  } else {
    vec.push_back(cn);
    if (ss.empty()) return;
    int nn = ss.top();
    ss.pop();
    trace(nn);
  }
  return;
}
int main() {
  int cases, M, ff, tt, mn;
  vec.clear();
  mn = 99999;
  ne = 0;
  memset(vis, 0, sizeof(vis));
  memset(nodes, -1, sizeof(nodes));
  memset(deg, 0, sizeof(deg));
  scanf("%d", &M);
  for (int i = 0; i < M; i++) {
    scanf("%d%d", &ff, &tt);
    deg[ff]++;
    deg[tt]++;
    edges[ff][tt].push_back(i);
    mn = min(mn, min(ff, tt));
    addEdge(ff, tt);
  }
  int odds = 0;
  bool failed = 1;
  for (int i = 0; i < 7; i++) {
    if (deg[i] % 2 != 0) {
      odds++;
      mn = i;
    }
  }
  if (odds < 3) {
    trace(mn);
    if (vec.size() - 1 == M) failed = 0;
  }
  if (failed)
    printf("No solution\n");
  else {
    for (int i = 0; i + 1 < vec.size(); i++) {
      if (edges[vec[i]][vec[i + 1]].size()) {
        printf("%d +\n",
               edges[vec[i]][vec[i + 1]][edges[vec[i]][vec[i + 1]].size() - 1] +
                   1);
        edges[vec[i]][vec[i + 1]].pop_back();
      } else {
        printf("%d -\n",
               edges[vec[i + 1]][vec[i]][edges[vec[i + 1]][vec[i]].size() - 1] +
                   1);
        edges[vec[i + 1]][vec[i]].pop_back();
      }
    }
  }
  return 0;
}