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;
multiset<int> c[7];
int x[101];
int y[101];
vector<pair<int, int> > v;
set<int> vis;
bool isempty() {
  for (int i = 0; i < 7; i++) {
    if (!c[i].empty()) return false;
  }
  return true;
}
int next(vector<pair<int, int> > &w, int s) {
  int j = *c[s].begin();
  c[s].erase(j);
  int p = x[j];
  int sw = 1;
  if (p == s) {
    p = y[j];
    sw = 0;
  }
  c[p].erase(j);
  w.push_back(make_pair(j, sw));
  return p;
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x[i] >> y[i];
    c[x[i]].insert(i);
    c[y[i]].insert(i);
  }
  int z = 0;
  int s = -1;
  for (int i = 0; i < 7; i++) {
    if (c[i].size() % 2 != 0) {
      z++;
      s = i;
    }
    if (s == -1 && !c[i].empty()) {
      s = i;
    }
  }
  if (z != 0 && z != 2) {
    cout << "No solution" << endl;
    return 0;
  }
  vis.insert(s);
  while (c[s].size() % 2 == 1) {
    s = next(v, s);
    if (vis.count(s) == 0) vis.insert(s);
  }
  while (!isempty()) {
    bool added = false;
    for (int i = 0; i < 7; i++) {
      if (vis.count(i) == 0) continue;
      if (c[i].empty()) continue;
      vector<pair<int, int> > w;
      s = i;
      added = true;
      do {
        s = next(w, s);
        if (vis.count(s) == 0) vis.insert(s);
      } while (s != i);
      vector<pair<int, int> >::iterator j;
      for (j = v.begin(); j != v.end(); ++j) {
        int p = (j->second ? y[j->first] : x[j->first]);
        if (p == i) break;
      }
      v.insert(j, w.begin(), w.end());
    }
    if (!added) {
      cout << "No solution" << endl;
      return 0;
    }
  }
  for (int i = 0; i < (int)v.size(); i++) {
    cout << v[i].first + 1 << " " << (v[i].second ? "-" : "+") << endl;
  }
}