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 v, num, flag, next;
} edge[1010 * 1010];
int node[1010], used;
bool can[1010];
int degree[1010];
bool visited[1010];
void addedge(int u, int v, int num, bool flag);
void dfs(int now);
void dfsfind(int now, int num);
int ans[1010], cnans;
int main() {
  int n;
  while (cin >> n) {
    used = 0;
    memset(node, -1, sizeof node);
    memset(can, false, sizeof can);
    for (int i = 1; i <= n; i++) {
      int u, v;
      cin >> u >> v;
      addedge(u, v, i, true);
      addedge(v, u, i, false);
      degree[u]++;
      degree[v]++;
    }
    bool nosolution = false;
    memset(visited, false, sizeof visited);
    for (int i = 0; i <= 6; i++) {
      if (degree[i] <= 0) continue;
      dfs(i);
      for (int j = 0; j <= 6; j++)
        if (visited[j] == false && degree[j] > 0) nosolution = true;
      break;
    }
    if (nosolution == false) {
      int cnt = 0;
      for (int i = 0; i <= 6; i++)
        if (degree[i] % 2) cnt++;
      if (cnt == 1 || cnt > 2) nosolution = true;
    }
    if (nosolution == false) {
      int k = 0;
      for (int i = 0; i <= 6; i++) {
        if (degree[i]) k = i;
        if (degree[i] % 2) break;
      }
      memset(visited, false, sizeof visited);
      dfsfind(k, 0);
    }
    if (nosolution)
      cout << "No solution" << endl;
    else {
      for (int i = cnans - 2; i >= 0; i--) {
        if (ans[i] < 0)
          cout << -ans[i] << " -" << endl;
        else
          cout << ans[i] << " +" << endl;
      }
    }
  }
  return 0;
}
void addedge(int u, int v, int num, bool flag) {
  edge[used].v = v;
  edge[used].flag = flag;
  edge[used].num = num;
  edge[used].next = node[u];
  node[u] = used++;
}
void dfs(int now) {
  visited[now] = true;
  for (int j = node[now]; j != -1; j = edge[j].next) {
    if (visited[edge[j].v] == false) dfs(edge[j].v);
  }
}
void dfsfind(int now, int num) {
  for (int j = node[now]; j != -1; j = edge[j].next) {
    if (visited[edge[j].num] == false) {
      visited[edge[j].num] = true;
      int temp = edge[j].num;
      if (edge[j].flag == false) temp = -temp;
      dfsfind(edge[j].v, temp);
    }
  }
  ans[cnans++] = num;
}