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>
const int NUM = 100010;
const double eps = 1e-10, pi = acos(-1.0);
using namespace std;
int n, lf[110], rg[110];
int num[10];
bool vis[2200];
int ans[110], ansi;
struct edge {
  int to, next;
} e[2200];
int head[10], tot;
void add_edge(int u, int v) {
  e[tot].to = v;
  e[tot].next = head[u];
  head[u] = tot++;
}
void dfs(int u) {
  for (int i = head[u]; i; i = e[i].next)
    if (!vis[i]) {
      vis[i] = true;
      vis[i ^ 1] = true;
      dfs(e[i].to);
      ans[ansi++] = i;
    }
}
int main() {
  int i, j;
  scanf("%d", &n);
  tot = 2;
  for (i = 1; i <= n; i++) {
    scanf("%d%d", &lf[i], &rg[i]);
    num[lf[i]]++;
    num[rg[i]]++;
    add_edge(lf[i], rg[i]);
    add_edge(rg[i], lf[i]);
  }
  int f = 0, s = 0;
  for (i = 0; i <= 6; i++)
    if (num[i] & 1) {
      s = i;
      f++;
    }
  if (f <= 2) {
    if (!f) s = lf[1];
    dfs(s);
  }
  if (ansi == n) {
    for (i = n - 1; i >= 0; i--)
      printf("%d %c\n", ans[i] >> 1, ans[i] & 1 ? '-' : '+');
  } else
    printf("No solution\n");
  return 0;
}