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;
bool mark[7];
vector<int> p;
vector<pair<int, int> > d;
int n, a[7], x, y, moAllafe, b[7][7];
vector<pair<pair<int, bool>, pair<int, pair<int, int> > > > ed[7];
int dfs(int v) {
  mark[v] = true;
  for (int i = 0; i < ed[v].size(); i++) {
    if (!mark[ed[v][i].first.first] && !ed[v][i].first.second) {
      dfs(ed[v][i].first.first);
    }
  }
}
bool check(int v, int u) {
  if (b[v][u] > 1 || v == u) {
    return false;
  }
  for (int i = 0; i < 7; i++) {
    mark[i] = false;
  }
  mark[v] = true;
  for (int i = 0; i < ed[v].size(); i++) {
    if (ed[v][i].first.first != u && ed[v][i].first.first != v &&
        !mark[ed[v][i].first.first] && !ed[v][i].first.second) {
      dfs(ed[v][i].first.first);
    }
  }
  if (mark[u]) {
    return false;
  }
  return true;
}
int DO(int x, int c) {
  for (int i = 0; i < ed[x].size(); i++) {
    if (!(a[ed[x][i].first.first] % 2) && c < n && (!ed[x][i].first.second) &&
        !check(x, ed[x][i].first.first)) {
      d.push_back(
          make_pair(ed[x][i].second.first, ed[x][i].second.second.first));
      ed[x][i].first.second = true;
      ed[ed[x][i].first.first][ed[x][i].second.second.second].first.second =
          true;
      b[x][ed[x][i].first.first]--;
      b[ed[x][i].first.first][x]--;
      DO(ed[x][i].first.first, c + 1);
    } else if ((!ed[x][i].first.second) && c < n &&
               !check(x, ed[x][i].first.first)) {
      d.push_back(
          make_pair(ed[x][i].second.first, ed[x][i].second.second.first));
      ed[x][i].first.second = true;
      ed[ed[x][i].first.first][ed[x][i].second.second.second].first.second =
          true;
      b[x][ed[x][i].first.first]--;
      b[ed[x][i].first.first][x]--;
      DO(ed[x][i].first.first, c + 1);
    } else if (!ed[x][i].first.second && c == n) {
      d.push_back(
          make_pair(ed[x][i].second.first, ed[x][i].second.second.first));
    } else if (i == ed[x].size() - 1) {
      for (int j = 0; j < ed[x].size(); j++) {
        if (c < n && (!ed[x][j].first.second)) {
          d.push_back(
              make_pair(ed[x][j].second.first, ed[x][j].second.second.first));
          ed[x][j].first.second = true;
          ed[ed[x][j].first.first][ed[x][j].second.second.second].first.second =
              true;
          b[x][ed[x][j].first.first]--;
          b[ed[x][j].first.first][x]--;
          DO(ed[x][j].first.first, c + 1);
        }
      }
    }
  }
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> x >> y;
    b[x][y]++;
    b[y][x]++;
    if (x != y) {
      ed[x].push_back(make_pair(make_pair(y, false),
                                make_pair(i, make_pair(0, ed[y].size()))));
      ed[y].push_back(make_pair(make_pair(x, false),
                                make_pair(i, make_pair(1, ed[x].size() - 1))));
    } else {
      ed[x].push_back(make_pair(make_pair(x, false),
                                make_pair(i, make_pair(0, ed[x].size()))));
    }
    a[y]++;
    a[x]++;
  }
  for (int i = 0; i < 7; i++) {
    if (a[i] % 2) {
      p.push_back(i);
    }
  }
  if (p.size() != 0 && p.size() != 2) {
    cout << "No solution" << endl;
    return 0;
  }
  for (int i = 0; i <= 6; i++) {
    if (!mark[i] && a[i]) {
      dfs(i);
      moAllafe++;
    }
  }
  if (moAllafe != 1) {
    cout << "No solution" << endl;
    return 0;
  }
  if (p.size()) {
    a[p[0]]--;
    DO(p[0], 1);
  } else {
    for (int i = 0; i < 7; i++) {
      if (a[i]) {
        DO(i, 1);
        break;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    if (!d[i].second) {
      cout << d[i].first << " + " << endl;
    } else {
      cout << d[i].first << " - " << endl;
    }
  }
  return 0;
}