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;
int n;
const int N = 52;
int edge[N][N];
int degree[N];
bool alive[N];
bool visited[N];
bool dfs(int x, int from) {
  if (visited[x]) return false;
  visited[x] = 1;
  bool ret = false;
  if (from == x) ret = true;
  for (int next = (int)0; next < (int)n; next++)
    if (edge[x][next]) ret |= dfs(next, from);
  return ret;
}
bool is_connected() {
  memset(visited, 0, sizeof(visited));
  for (int i = (int)0; i < (int)n; i++)
    if (degree[i]) {
      dfs(i, -1);
      break;
    }
  for (int i = (int)0; i < (int)n; i++)
    if (degree[i] and !visited[i]) return false;
  return true;
}
int main() {
  ios::sync_with_stdio(false);
  vector<pair<pair<int, int>, int> > dominoes;
  n = 50;
  int m;
  cin >> m;
  for (int i = (int)0; i < (int)m; i++) {
    int a, b;
    cin >> a >> b;
    dominoes.push_back(make_pair(pair<int, int>(a, b), -1));
    edge[a][b]++, edge[b][a]++;
    degree[a]++, degree[b]++;
  }
  int nodd = 0;
  for (int i = (int)0; i < (int)n; i++)
    if (degree[i] % 2) nodd++;
  if (nodd > 2 or !is_connected()) {
    cout << "No solution\n";
    return 0;
  }
  vector<int> tour(m);
  int prev = -1;
  for (int i = (int)0; i < (int)n; i++)
    if (degree[i] % 2 == 1 and prev == -1) prev = i;
  for (int i = (int)0; i < (int)n; i++)
    if (degree[i] > 0 and prev == -1) prev = i;
  for (int i = (int)0; i < (int)m; i++) {
    for (int next = (int)0; next < (int)n; next++) {
      if (edge[prev][next] == 0) continue;
      edge[prev][next]--, edge[next][prev]--;
      degree[prev]--, degree[next]--;
      memset(visited, 0, sizeof(visited));
      if (degree[prev] == 0 or dfs(prev, next)) {
        for (int j = (int)0; j < (int)m; j++)
          if (dominoes[j].second == -1) {
            if (dominoes[j].first == pair<int, int>(prev, next)) {
              dominoes[j].second = 0;
              tour[i] = j;
              break;
            }
            if (dominoes[j].first == pair<int, int>(next, prev)) {
              dominoes[j].second = 1;
              tour[i] = j;
              break;
            }
          }
        prev = next;
        break;
      }
      edge[prev][next]++, edge[next][prev]++;
      degree[prev]++, degree[next]++;
    }
  }
  for (int i = (int)0; i < (int)m; i++)
    cout << (tour[i] + 1) << ' ' << (dominoes[tour[i]].second ? '-' : '+')
         << "\n";
  return 0;
}