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>
#pragma comment(linker, "/STACK:256000000")
using namespace std;
const int INF = 1000 * 1000 * 1000;
const double EPS = 1e-9;
int deg[7];
int g[7][7];
bool used[101];
int main() {
  int N;
  scanf("%d", &N);
  vector<pair<int, int> > d(N);
  for (int i = 0; i < N; ++i) {
    scanf("%d%d", &d[i].first, &d[i].second);
    ++g[d[i].first][d[i].second];
    ++g[d[i].second][d[i].first];
    ++deg[d[i].first];
    ++deg[d[i].second];
  }
  int stv = -1, finv = -1;
  for (int i = 0; i <= 6; ++i)
    if (deg[i] & 1)
      if (stv == -1) {
        stv = i;
      } else if (finv == -1) {
        finv = i;
      } else {
        puts("No solution");
        return 0;
      }
  if (stv != -1 && finv == -1) {
    puts("No solution");
    return 0;
  }
  if (stv != -1) {
    ++g[stv][finv];
    ++g[finv][stv];
  }
  stack<int> st;
  st.push(d[0].first);
  vector<int> res;
  while (!st.empty()) {
    int v = st.top();
    int to = -1;
    for (int i = 0; i <= 6; ++i)
      if (g[v][i]) {
        --g[v][i];
        --g[i][v];
        to = i;
        break;
      }
    if (to != -1) {
      st.push(to);
    } else {
      st.pop();
      res.push_back(v);
    }
  }
  for (int i = 0; i + 1 < (int)res.size(); ++i)
    if (res[i] == stv && res[i + 1] == finv ||
        res[i] == finv && res[i + 1] == stv) {
      vector<int> resa;
      for (int j = i + 1; j < (int)res.size(); ++j) {
        resa.push_back(res[j]);
      }
      for (int j = 0; j <= i; ++j) {
        resa.push_back(res[j]);
      }
      res = resa;
    }
  for (int i = 0; i <= 6; ++i)
    for (int j = 0; j <= 6; ++j)
      if (g[i][j]) {
        puts("No solution");
        return 0;
      }
  for (int i = 0; i + 1 < (int)res.size(); ++i)
    for (int j = 0; j < N; ++j)
      if (!used[j]) {
        if (d[j].first == res[i] && d[j].second == res[i + 1]) {
          printf("%d +\n", j + 1);
          used[j] = true;
          break;
        }
        if (d[j].second == res[i] && d[j].first == res[i + 1]) {
          printf("%d -\n", j + 1);
          used[j] = true;
          break;
        }
      }
  return 0;
}