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;
template <typename T>
inline void checkMax(T& a, const T& b) {
  if (a < b) a = b;
}
template <typename T>
inline void checkMin(T& a, const T& b) {
  if (a > b) a = b;
}
template <typename T>
struct LinkedEdge {
  T data;
  int dest;
  LinkedEdge<T>* next;
};
template <int kMaxNode, int kMaxEdge, typename T>
struct EdgeList {
  LinkedEdge<T>* head[kMaxNode];
  LinkedEdge<T> edges[kMaxEdge];
  int cnt_edge, num_node;
  void init(int _num_node) {
    num_node = _num_node;
    std::fill(head, head + num_node, (LinkedEdge<T>*)0);
    cnt_edge = 0;
  }
  LinkedEdge<T>* add_edge(int x, int y, const T& data) {
    edges[cnt_edge].data = data;
    edges[cnt_edge].dest = y;
    edges[cnt_edge].next = head[x];
    head[x] = edges + cnt_edge;
    ++cnt_edge;
    return edges + cnt_edge - 1;
  }
};
const int kMaxN = 100 + 10;
const int kMaxNode = 7;
char direction[kMaxN];
int deg[kMaxNode];
int n;
vector<int> order;
EdgeList<kMaxNode, kMaxN + kMaxN, int> elist;
void get_euler(int v) {
  for (__typeof__(elist.head[0]) e = elist.head[v]; e != 0; e = e->next) {
    if (direction[e->data >> 1] != '.') continue;
    direction[e->data >> 1] = (e->data & 1) ? '-' : '+';
    --deg[v];
    --deg[e->dest];
    get_euler(e->dest);
    order.push_back(e->data >> 1);
  }
}
int main() {
  elist.init(kMaxNode);
  scanf("%d", &n);
  int a, b;
  fill(deg, deg + kMaxNode, 0);
  for (int n___LINE__ = (n), i = 0; i < n___LINE__; ++i) {
    scanf("%d%d", &a, &b);
    direction[i] = '.';
    deg[a]++, deg[b]++;
    elist.add_edge(a, b, i << 1);
    elist.add_edge(b, a, (i << 1) | 1);
  }
  int cnt_odd = 0;
  for (int n___LINE__ = (kMaxNode), i = 0; i < n___LINE__; ++i) {
    if (deg[i] & 1) {
      ++cnt_odd;
    }
  }
  if (cnt_odd > 2) {
    puts("No solution");
  } else {
    int start_node = -1, cnt_comp = 0;
    for (int n___LINE__ = (kMaxNode), i = 0; i < n___LINE__; ++i) {
      if (deg[i] > 0 && (start_node < 0 || (deg[i] & 1))) {
        start_node = i;
      }
    }
    order.clear();
    get_euler(start_node);
    if (((int)(order).size()) != n) {
      puts("No solution");
    } else {
      for (int n___LINE__ = (n), i = 0; i < n___LINE__; ++i) {
        printf("%d %c\n", order[n - i - 1] + 1, direction[order[n - i - 1]]);
      }
    }
  }
  return 0;
}