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 maxN = 1e5 + 100;
int n, x, y, a[10];
vector<int> dom[10][10], g[maxN], ans;
int tedad[10][10];
char ch[200];
void dfs(int v) {
  for (long long int i = 0; i <= (int)g[v].size() - 1; i++) {
    if (tedad[v][g[v][i]] > 0) {
      tedad[v][g[v][i]]--;
      tedad[g[v][i]][v]--;
      dfs(g[v][i]);
    }
  }
  ans.push_back(v);
}
void input() {
  cin >> n;
  for (long long int i = 1; i <= n; i++) {
    cin >> x >> y;
    tedad[x][y]++;
    tedad[y][x]++;
    dom[x][y].push_back(i);
    a[x]++;
    a[y]++;
    g[x].push_back(y);
    g[y].push_back(x);
  }
}
void show() {
  for (long long int i = 0; i <= ans.size() - 2; i++) {
    if (dom[ans[i]][ans[i + 1]].size()) {
      cout << dom[ans[i]][ans[i + 1]][dom[ans[i]][ans[i + 1]].size() - 1]
           << " +" << endl;
      dom[ans[i]][ans[i + 1]].pop_back();
    } else if (dom[ans[i + 1]][ans[i]].size()) {
      cout << dom[ans[i + 1]][ans[i]][dom[ans[i + 1]][ans[i]].size() - 1]
           << " -" << endl;
      dom[ans[i + 1]][ans[i]].pop_back();
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  input();
  int q = 0;
  x = -1;
  for (long long int i = 0; i <= 6; i++) {
    if (a[i] % 2) {
      x = i;
      q++;
    }
  }
  if (q != 0 && q != 2) {
    cout << "No solution";
    return 0;
  }
  if (x == -1) {
    for (long long int i = 0; i <= 6; i++)
      if (a[i]) x = i;
  }
  dfs(x);
  if (ans.size() != n + 1) {
    cout << "No solution";
    return 0;
  }
  show();
  return 0;
}