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;
template <class T>
T two(T x) {
  return 1 << x;
}
template <class T>
inline void Min(T &x, T y) {
  if (y < x) x = y;
}
template <class T>
inline void Max(T &x, T y) {
  if (y > x) x = y;
}
const int maxn = 200010;
const int mod = 1000000007;
const int inf = ~0u >> 2;
vector<pair<int, int> > edge[10];
int du[10];
bool ve[110];
int fa[10];
int v[10];
int find(int x) { return fa[x] == x ? x : fa[x] = find(fa[x]); }
vector<pair<int, char> > ans;
int Left[110];
void dfs(int u, int eid) {
  for (int i = 0; i < du[u]; i++) {
    if (!ve[edge[u][i].second]) {
      ve[edge[u][i].second] = true;
      dfs(edge[u][i].first, edge[u][i].second);
    }
  }
  if (eid != -1) ans.push_back(make_pair(eid + 1, u == Left[eid] ? '-' : '+'));
}
int main() {
  int n, a, b;
  int roots = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &a, &b);
    Left[i] = a;
    if (!v[a]) v[a] = 1, fa[a] = a, roots++;
    if (!v[b]) v[b] = 1, fa[b] = b, roots++;
    if (find(a) != find(b)) {
      roots--;
      fa[find(a)] = find(b);
    }
    du[a]++;
    du[b]++;
    edge[a].push_back(make_pair(b, i));
    edge[b].push_back(make_pair(a, i));
  }
  int odd = 0;
  for (int i = 0; i < 7; i++)
    if (du[i] & 1) odd++;
  if (odd != 2 && odd != 0 || roots > 1) {
    puts("No solution");
  } else {
    if (odd == 2) {
      for (int i = 0; i < 7; i++)
        if (du[i] & 1) a = i;
    } else {
      for (int i = 0; i < 7; i++)
        if (du[i]) a = i;
    }
    dfs(a, -1);
  }
  for (int i = ans.size() - 1; i >= 0; i--) {
    printf("%d %c\n", ans[i].first, ans[i].second);
  }
  return 0;
}