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