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 MAXN = 105;
int N, cnt = 0, tmp = 0, pos = -1, ans_tot = 0;
int fa[10], num[10], ans[MAXN], head[MAXN];
struct node {
  int to, nxt;
  bool flag;
  int vis, id;
} edge[MAXN << 1];
void add(int u, int v, bool flag, int id) {
  edge[cnt].to = v;
  edge[cnt].nxt = head[u];
  edge[cnt].flag = flag;
  edge[cnt].id = id;
  head[u] = cnt++;
}
void init() {
  memset(head, -1, sizeof(head));
  for (int i = 0; i <= 6; i++) fa[i] = i;
}
int find(int u) {
  if (fa[u] != u) fa[u] = find(fa[u]);
  return fa[u];
}
bool check_1() {
  for (int i = 0; i <= 6; i++)
    if (num[i] & 1) tmp++;
  if (tmp == 0 || tmp == 2) return false;
  return true;
}
bool check_2() {
  for (int i = 0; i <= 6; i++) {
    if (pos == -1 && num[i])
      pos = i;
    else if (num[i]) {
      int fu = find(pos);
      int fv = find(i);
      if (fu != fv) return true;
    }
  }
  return false;
}
void dfs(int u) {
  for (int i = head[u]; i != -1; i = edge[i].nxt) {
    if (edge[i].vis) continue;
    edge[i].vis = edge[i ^ 1].vis = 1;
    dfs(edge[i].to);
    ans[++ans_tot] = i;
  }
}
int main() {
  scanf("%d", &N);
  init();
  for (int i = 1, u, v; i <= N; i++) {
    scanf("%d%d", &u, &v);
    num[u]++;
    num[v]++;
    add(u, v, 0, i);
    add(v, u, 1, i);
    int fu = find(u);
    int fv = find(v);
    if (fu != fv) fa[fu] = fv;
  }
  if (check_1() || check_2()) {
    printf("No solution");
  } else {
    if (!tmp)
      dfs(pos);
    else {
      for (int i = 0; i <= 6; i++)
        if (num[i] & 1) {
          dfs(i);
          break;
        }
    }
    for (int i = 1; i <= N; i++) {
      printf("%d ", edge[ans[i]].id);
      if (edge[ans[i]].flag)
        printf("+\n");
      else
        printf("-\n");
    }
  }
  return 0;
}