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 u, v, ind;
  bool used;
  Edge() {}
  Edge(int u, int v, int ind) : u(u), v(v), ind(ind), used(false) {}
};
int num_nodes;
vector<vector<Edge> > adj;
void add_edge(int u, int v, int ind) {
  adj[u].push_back(Edge(u, v, ind));
  adj[v].push_back(Edge(v, u, -ind));
}
int euler_path_start() {
  int num_odds = 0;
  int start_vertex = 0;
  while (start_vertex < num_nodes) {
    if (!adj[start_vertex].empty()) {
      break;
    }
    ++start_vertex;
  }
  for (int i = 0; i < num_nodes; ++i) {
    if (adj[i].size() & 1) {
      ++num_odds;
      start_vertex = i;
    }
  }
  if (num_odds > 2) {
    start_vertex = -1;
  }
  return start_vertex;
}
int num_connected_without_edge(int u, int v) {
  vector<bool> visited(num_nodes, false);
  queue<int> q;
  q.push(u);
  visited[u] = true;
  int answer = 0;
  while (!q.empty()) {
    int now = q.front();
    q.pop();
    ++answer;
    int qnt = 0;
    for (vector<Edge>::iterator it = adj[now].begin(); it != adj[now].end();
         ++it) {
      if ((*it).used == false && visited[(*it).v] == false) {
        if ((*it).u == u && (*it).v == v) {
          ++qnt;
        }
        if (((*it).u != u || (*it).v != v) || qnt > 1) {
          visited[(*it).v] = true;
          q.push((*it).v);
        }
      }
    }
  }
  return answer;
}
bool is_bridge(int u, int v) {
  int x = num_connected_without_edge(u, -1);
  int y = num_connected_without_edge(u, v);
  return x != y;
}
void euler_path_aux(vector<Edge>& path, int u) {
  vector<Edge>::iterator to_use;
  int bridge_position = -1;
  bool found = false;
  for (vector<Edge>::iterator it = adj[u].begin(); it != adj[u].end(); ++it) {
    if ((*it).used == false) {
      if (bridge_position != -1 || !is_bridge(u, (*it).v)) {
        (*it).used = true;
        to_use = it;
        found = true;
        break;
      } else {
        bridge_position = it - adj[u].begin();
      }
    }
  }
  if (!found && bridge_position == -1) {
    return;
  }
  if (!found) {
    adj[u][bridge_position].used = true;
    to_use = adj[u].begin() + bridge_position;
  }
  for (vector<Edge>::iterator it = adj[(*to_use).v].begin();
       it != adj[(*to_use).v].end(); ++it) {
    if ((*it).v == u && (*it).used == false) {
      (*it).used = true;
      break;
    }
  }
  path.push_back(*to_use);
  euler_path_aux(path, (*to_use).v);
}
vector<Edge> euler_path() {
  vector<Edge> answer;
  int start_vertex = euler_path_start();
  if (start_vertex != -1) {
    euler_path_aux(answer, start_vertex);
  }
  return answer;
}
vector<Edge> edges;
int main() {
  int n = 7, m;
  adj.assign(7, vector<Edge>());
  scanf("%d", &m);
  num_nodes = n;
  for (int i = 0; i < m; ++i) {
    int u, v;
    scanf("%d %d", &u, &v);
    add_edge(u, v, i + 1);
    edges.push_back(Edge(u, v, i));
  }
  vector<Edge> path = euler_path();
  if (path.size() != m) {
    printf("No solution\n");
  } else {
    for (int i = 0; i < path.size(); ++i) {
      int ind = path[i].ind;
      if (ind > 0) {
        printf("%d +\n", ind);
      } else {
        printf("%d -\n", -ind);
      }
    }
  }
  return 0;
}