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 <typename T>
T abs(T x) {
  return x > 0 ? x : -x;
}
const int maxn = 105;
int g[10][10];
int deg[10];
map<pair<int, int>, vector<int> > d;
int main() {
  int n;
  cin >> n;
  int startV = 10;
  for (int i = 0; i < n; i++) {
    int u, v;
    cin >> u >> v;
    d[make_pair(u, v)].push_back(i + 1);
    g[u][v]++;
    g[v][u]++;
    deg[u]++;
    deg[v]++;
    startV = v;
  }
  int oddCnt = 0;
  for (int i = 0; i <= 6; i++)
    if (deg[i] & 1) oddCnt++;
  if (!(oddCnt == 0 || oddCnt == 2)) {
    puts("No solution");
    return 0;
  }
  int addI = -1, addJ = -1;
  if (oddCnt) {
    for (int i = 0; i <= 6; i++) {
      if (deg[i] & 1) {
        for (int j = i + 1; j <= 6; j++) {
          if (deg[j] & 1) {
            addI = i;
            addJ = j;
            g[i][j]++;
            g[j][i]++;
            deg[i]++;
            deg[j]++;
          }
        }
      }
    }
  }
  stack<int> s;
  s.push(startV);
  vector<int> cycle;
  while (!s.empty()) {
    int v = s.top();
    if (!deg[v]) {
      cycle.push_back(v);
      s.pop();
    } else {
      for (int i = 0; i <= 6; i++) {
        if (g[v][i]) {
          g[v][i]--;
          g[i][v]--;
          deg[v]--;
          deg[i]--;
          s.push(i);
          break;
        }
      }
    }
  }
  for (int i = 0; i < (int)cycle.size() - 1; i++) {
    int curr = cycle[i];
    int nxt = cycle[i + 1];
    if ((curr == addI && nxt == addJ) || (curr == addJ && nxt == addI)) {
      rotate(cycle.begin(), cycle.begin() + i + 1, cycle.end());
      break;
    }
  }
  vector<pair<int, bool> > ans;
  for (int i = 0; i < (int)cycle.size() - 1; i++) {
    int curr = cycle[i];
    int nxt = cycle[(i + 1) % cycle.size()];
    if (!d[make_pair(curr, nxt)].empty()) {
      ans.push_back(make_pair(d[make_pair(curr, nxt)].back(), true));
      d[make_pair(curr, nxt)].pop_back();
    } else if (!d[make_pair(nxt, curr)].empty()) {
      ans.push_back(make_pair(d[make_pair(nxt, curr)].back(), false));
      d[make_pair(nxt, curr)].pop_back();
    }
  }
  if (ans.size() != n) {
    puts("No solution");
    return 0;
  }
  for (int i = 0; i < ans.size(); i++)
    cout << ans[i].first << " " << (ans[i].second ? "+" : "-") << endl;
  return 0;
}