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 inv = 1000000000;
const int minv = -inv;
const int max_n = 110;
vector<pair<int, int> > adjl[7];
bool used[max_n] = {0};
int nused = 0;
pair<int, int> s[max_n + 1];
int ns;
pair<int, int> ts[max_n + 1];
int nts;
int n;
pair<int, int> edge[max_n];
int deg[7];
int fst;
int o[7], no;
bool visited[max_n] = {0};
pair<int, int> par[max_n];
void DFS(int vt) {
  visited[vt] = true;
  for (int i = 0; i < adjl[vt].size(); ++i) {
    int nb = adjl[vt][i].first;
    int ix = adjl[vt][i].second;
    if ((not used[ix]) and (not visited[nb])) {
      par[nb] = pair<int, int>(vt, ix);
      DFS(nb);
    }
  }
}
bool cyc;
vector<pair<int, int> > c;
int src;
void DFS2(int vt) {
  if (cyc) return;
  visited[vt] = true;
  for (int i = 0; i < adjl[vt].size(); ++i) {
    if (cyc) return;
    int nb = adjl[vt][i].first;
    int ix = adjl[vt][i].second;
    if ((not used[ix]) and (not visited[nb])) {
      par[nb] = pair<int, int>(vt, ix);
      DFS2(nb);
    } else if ((not used[ix]) and nb == src and (ix != par[vt].second)) {
      cyc = true;
      c.push_back(pair<int, int>(vt, ix));
      used[ix] = true;
      ++nused;
      int v = vt;
      while (true) {
        if (par[v].first == -1) break;
        used[par[v].second] = true;
        ++nused;
        c.push_back(par[v]);
        v = par[v].first;
      }
      return;
    }
  }
}
int main() {
  scanf("%d", &n);
  int a, b;
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a);
    scanf("%d", &b);
    edge[i] = pair<int, int>(a, b);
    adjl[a].push_back(pair<int, int>(b, i));
    ++deg[a];
    adjl[b].push_back(pair<int, int>(a, i));
    ++deg[b];
  }
  no = 0;
  for (int i = 0; i < 7; ++i)
    if (deg[i] % 2) o[no++] = i;
  if (no != 0 and no != 2) {
    printf("No solution\n");
    return 0;
  }
  if (no == 2) {
    fill(visited, visited + 7, 0);
    par[o[0]] = pair<int, int>(-1, -1);
    DFS(o[0]);
  } else {
    for (int i = 0; i < 7; ++i)
      if (deg[i] > 0) {
        fst = i;
        fill(visited, visited + 7, false);
        par[i] = pair<int, int>(-1, -1);
        DFS(i);
        break;
      }
  }
  for (int i = 0; i < 7; ++i)
    if (deg[i] > 0 and (not visited[i])) {
      printf("No solution\n");
      return 0;
    }
  ns = 0;
  if (no == 2) {
    s[ns++] = pair<int, int>(o[1], -1);
    int v = o[1];
    while (true) {
      if (par[v].first == -1) break;
      used[par[v].second] = true;
      ++nused;
      s[ns++] = par[v];
      v = par[v].first;
    }
  } else
    s[ns++] = pair<int, int>(fst, -1);
  while (nused < n) {
    for (int i = 0; i < ns; ++i) {
      fill(visited, visited + 7, false);
      src = s[i].first;
      par[src] = pair<int, int>(-1, -1);
      cyc = false;
      c.resize(0);
      DFS2(src);
      if (cyc) {
        nts = 0;
        for (int j = 0; j <= i; ++j) ts[nts++] = s[j];
        for (int j = 0; j < c.size(); ++j) ts[nts++] = c[j];
        for (int j = i + 1; j < ns; ++j) ts[nts++] = s[j];
        ns = nts;
        for (int i = 0; i < ns; ++i) s[i] = ts[i];
        break;
      }
    }
  }
  for (int i = 1; i < ns; ++i) {
    printf("%d ", s[i].second + 1);
    if (pair<int, int>(s[i - 1].first, s[i].first) == edge[s[i].second])
      printf("+\n");
    else
      printf("-\n");
  }
  return 0;
}