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 dfs(int prev, vector<vector<int>>& map, vector<pair<int, int>>& result,
         int pos) {
  for (int i = 0; i < map.size(); i++) {
    if (map[prev][i] > 0) {
      map[prev][i]--;
      map[i][prev]--;
      if (!dfs(i, map, result, pos + 1)) {
        return false;
      }
      if (result.size() && result.back().second != i) {
        return false;
      }
      result.push_back(make_pair(i, prev));
    }
  }
  return true;
}
void output(const vector<pair<int, int>>& result,
            vector<pair<int, int>>& dominos) {
  for (const auto& bone : result) {
    for (int i = 0; i < dominos.size(); i++) {
      if (bone.first == dominos[i].first && bone.second == dominos[i].second) {
        cout << i + 1 << " +\n";
        dominos[i] = make_pair(-1, -1);
        break;
      }
      if (bone.first == dominos[i].second && bone.second == dominos[i].first) {
        cout << i + 1 << " -\n";
        dominos[i] = make_pair(-1, -1);
        break;
      }
    }
  }
}
int main() {
  vector<vector<int>> map(7, vector<int>(7));
  vector<pair<int, int>> dominos;
  vector<int> count(7, 0);
  int n;
  cin >> n;
  dominos.resize(n, pair<int, int>(0, 0));
  for (auto& domino : dominos) {
    cin >> domino.first;
    cin >> domino.second;
    map[domino.first][domino.second]++;
    map[domino.second][domino.first]++;
    count[domino.first]++;
    count[domino.second]++;
  }
  vector<pair<int, int>> result;
  int first = dominos[0].first;
  for (int i = 0; i < count.size(); i++) {
    if (count[i] % 2) {
      first = i;
      break;
    }
  }
  if (dfs(first, map, result, 0) && result.size() == n) {
    output(result, dominos);
  } else {
    cout << "No solution\n";
  }
  return 0;
}