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 = 1000 * 1000 + 10;
const int maxn5 = 5 * 1000 * 100 + 10;
const int maxn3 = 1000 + 10;
const long long mod = 1000 * 1000 * 1000 + 7;
const long long inf = 1LL * 2 * 1000 * 1000 * 1000 * 1000 * 1000 * 1000 + 10;
bool mark[maxn5], seen[10];
vector<int> adj[10], ind[10];
map<int, pair<int, int>> m;
int pt[10];
void dfs(int v) {
  seen[v] = true;
  for (auto u : adj[v])
    if (!seen[u]) dfs(u);
  return;
}
void tour(int v) {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  while (pt[v] < adj[v].size()) {
    if (!mark[ind[v][pt[v]]]) {
      mark[ind[v][pt[v]]] = true;
      int a = ind[v][pt[v]];
      tour(adj[v][pt[v]]);
      cout << a << ' ' << (m[a].first == v ? '-' : '+') << '\n';
    }
    pt[v]++;
  }
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    m[i + 1] = {a, b};
    adj[a].push_back(b), adj[b].push_back(a);
    ind[a].push_back(i + 1), ind[b].push_back(i + 1);
  }
  int cnt = 0, v = 0;
  for (int i = 0; i < 7; i++)
    if (adj[i].size() % 2 == 1) cnt++, v = i;
  if (cnt > 2) return cout << "No solution\n", 0;
  if (cnt == 0)
    for (int i = 0; i < 7; i++)
      if (adj[i].size() > 0) v = i;
  dfs(v);
  for (int i = 0; i < 7; i++)
    if (!seen[i] and adj[i].size() > 0) return cout << "No solution\n", 0;
  tour(v);
  return 0;
}