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;
struct EDGE {
  int ind, a, b, nxt;
  char inv;
};
int n, idx, head[102], ind[7], hv[7];
bool vi[102];
EDGE ed[203];
void addedge(int a, int b, int ind, char inv) {
  ed[idx].a = a;
  ed[idx].b = b;
  ed[idx].ind = ind;
  ed[idx].inv = inv;
  ed[idx].nxt = head[a];
  head[a] = idx++;
}
int find(int x) {
  queue<int> q;
  bool v[7] = {0};
  int nxt, p, hv = 1;
  q.push(x);
  v[x] = 1;
  while (!q.empty()) {
    nxt = q.front();
    q.pop();
    for (p = head[nxt]; p != -1; p = ed[p].nxt) {
      if (!v[ed[p].b]) {
        ++hv;
        v[ed[p].b] = 1;
        q.push(ed[p].b);
      }
    }
  }
  return hv;
}
void FindPath(int s, int e, list<int>::iterator it, list<int> &li) {
  int p;
  for (p = head[s]; p != -1; p = ed[p].nxt) {
    if (!vi[ed[p].ind]) {
      vi[ed[p].ind] = 1;
      ++it;
      it = li.insert(it, p);
      s = ed[p].b;
      ++hv[ed[p].b];
      ++hv[ed[p].a];
      break;
    }
  }
  while (s != e) {
    for (p = head[s]; p != -1; p = ed[p].nxt) {
      if (!vi[ed[p].ind]) {
        vi[ed[p].ind] = 1;
        ++it;
        it = li.insert(it, p);
        s = ed[p].b;
        ++hv[ed[p].b];
        ++hv[ed[p].a];
        break;
      }
    }
  }
}
int main(int argc, char *argv[]) {
  scanf("%d", &n);
  int a, b, i, k;
  idx = 0;
  memset(vi, 0, sizeof(vi));
  memset(ind, 0, sizeof(ind));
  memset(hv, 0, sizeof(hv));
  memset(head, -1, sizeof(head));
  bool t[7] = {0};
  for (k = 0, i = 0; i < n; ++i) {
    scanf("%d%d", &a, &b);
    addedge(a, b, i, '+');
    addedge(b, a, i, '-');
    ++ind[a];
    ++ind[b];
    t[a] = 1;
    t[b] = 1;
  }
  k = 0;
  for (i = 0; i < 7; ++i) {
    if (t[i]) ++k;
  }
  if (find(a) < k) {
    puts("No solution");
    return 0;
  }
  k = 0;
  for (i = 0; i < 7; ++i) {
    if (ind[i] & 1) ++k;
  }
  if ((k != 0) && (k != 2)) {
    puts("No solution");
    return 0;
  }
  int s, e;
  if (k == 0) {
    s = ed[0].a, e = ed[0].a;
  } else {
    for (i = 0; i < 7; ++i) {
      if (ind[i] & 1) {
        s = i;
        break;
      }
    }
    for (++i; i < 7; ++i) {
      if (ind[i] & 1) {
        e = i;
        break;
      }
    }
  }
  list<int> li;
  FindPath(s, e, li.begin(), li);
  list<int>::iterator it;
  int p;
  while (hv[s] < ind[s]) {
    for (p = head[s]; p != -1; p = ed[p].nxt) {
      if (!vi[ed[p].ind]) {
        vi[ed[p].ind] = 1;
        li.push_front(p);
        ++hv[ed[p].b];
        ++hv[ed[p].a];
        FindPath(ed[p].b, s, li.begin(), li);
        break;
      }
    }
  }
  while (li.size() < n) {
    for (it = li.begin(); it != li.end(); ++it) {
      if (hv[ed[*it].b] < ind[ed[*it].b]) {
        FindPath(ed[*it].b, ed[*it].b, it, li);
      }
    }
  }
  for (it = li.begin(); it != li.end(); ++it) {
    printf("%d %c\n", ed[*it].ind + 1, ed[*it].inv);
  }
  return 0;
}