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;
template <class T>
string toStr(const T &x) {
  stringstream s;
  s << x;
  return s.str();
}
template <class T>
int toInt(const T &x) {
  stringstream s;
  s << x;
  int r;
  s >> r;
  return r;
}
int dx[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
int dy[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
struct Node {
  int id, sig;
};
const int N = 105;
int n;
vector<pair<int, int> > chips(N);
int comp(pair<int, int> i, int sig, pair<int, int> j) {
  if (sig) {
    if (i.second == j.first) return 1;
    if (i.second == j.second) return 0;
  } else {
    if (i.first == j.first) return 1;
    if (i.first == j.second) return 0;
  }
  return -1;
}
bool solve(int i, int sig) {
  stack<Node> Q;
  Node t;
  t.id = i;
  t.sig = sig;
  Q.push(t);
  int level = 0;
  vector<pair<int, int> > ans;
  int cont = 0;
  vector<int> visited(N);
  while (!Q.empty() && cont < 200) {
    cont++;
    int v = Q.top().id;
    int s = Q.top().sig;
    int leaf = true;
    if (visited[v]) {
      visited[v] = false;
      level--;
      ans.pop_back();
      Q.pop();
      continue;
    }
    ans.push_back(make_pair(v, s));
    visited[v] = true;
    level++;
    for (int x = 0; x < n; x++) {
      if (!visited[x + 1]) {
        int tmp = comp(chips[v], s, chips[x + 1]);
        if (tmp != -1) {
          leaf = false;
          t.id = x + 1;
          t.sig = tmp;
          Q.push(t);
        }
      }
    }
    if (leaf) {
      if (level == n) {
        for (int xx = 0; xx < n; xx++) {
          cout << ans[xx].first << " " << (ans[xx].second == 0 ? "-" : "+")
               << endl;
        }
        return true;
      }
      visited[v] = false;
      level--;
      ans.pop_back();
      Q.pop();
    }
  }
  return false;
}
int main() {
  int a, b;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    chips[i + 1] = make_pair(a, b);
  }
  for (int i = 0; i < n; i++) {
    if (solve(i + 1, 1) || solve(i + 1, 0)) return 0;
  }
  cout << "No solution" << endl;
  return 0;
}