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;
map<int, int> m;
vector<vector<long long> > ans;
using namespace std;
bool vis[7];
vector<int> edge_index[7][7];
int degree[7];
bool dfs(int u, int v) {
  if (u == v) {
    return true;
  }
  vis[u] = true;
  for (int i = 0; i <= 6; ++i) {
    if ((edge_index[u][i].size() > 0 || edge_index[i][u].size() > 0) &&
        vis[i] == false) {
      if (dfs(i, v)) {
        return true;
      }
    }
  }
  return false;
}
bool is_connected() {
  memset(vis, 0, sizeof(vis));
  for (int i = 0; i <= 6; ++i) {
    if (degree[i]) {
      dfs(i, -1);
      break;
    }
  }
  for (int i = 0; i <= 6; ++i) {
    if (degree[i] > 0 && vis[i] == false) {
      return false;
    }
  }
  return true;
}
int main(void) {
  int n;
  scanf("%d", &n);
  memset(degree, 0, sizeof(degree));
  for (int i = 0; i <= 6; ++i) {
    for (int j = 0; j <= 6; ++j) {
      edge_index[i][j].clear();
    }
  }
  for (int i = 1; i <= n; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    edge_index[u][v].push_back(i);
    degree[u]++;
    degree[v]++;
  }
  int n_odd = 0;
  for (int i = 0; i <= 6; ++i) {
    if (degree[i] % 2 == 1) {
      n_odd++;
    }
  }
  if (n_odd > 2 || is_connected() == false) {
    printf("No solution\n");
  } else {
    int u = -1;
    for (int i = 0; i <= 6; ++i) {
      if (degree[i] % 2 == 1) {
        u = i;
        break;
      }
    }
    if (u == -1) {
      for (int i = 0; i <= 6; ++i) {
        if (degree[i] > 0) {
          u = i;
          break;
        }
      }
    }
    for (int i = 0; i < n; ++i) {
      int selected_ind;
      bool forward_selected;
      for (int j = 0; j <= 6; ++j) {
        if (edge_index[u][j].size() > 0 || edge_index[j][u].size() > 0) {
          int cur_ind;
          bool forward;
          if (edge_index[u][j].size() > 0) {
            cur_ind = edge_index[u][j].back();
            edge_index[u][j].pop_back();
            forward = true;
          } else {
            cur_ind = edge_index[j][u].back();
            edge_index[j][u].pop_back();
            forward = false;
          }
          degree[u]--;
          degree[j]--;
          memset(vis, 0, sizeof(vis));
          if (degree[u] == 0 || dfs(u, j) == true) {
            selected_ind = cur_ind;
            forward_selected = forward;
            u = j;
            break;
          } else {
            if (forward) {
              edge_index[u][j].push_back(cur_ind);
            } else {
              edge_index[j][u].push_back(cur_ind);
            }
            degree[u]++;
            degree[j]++;
          }
        }
      }
      printf("%d %c\n", selected_ind, forward_selected ? '+' : '-');
    }
  }
  return 0;
}