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 = 7, n = 7, maxm = 101;
int m, cntblk = maxn, f[maxn], deg[maxn];
bool used[maxm];
class ed {
 public:
  int target, id;
  char type;
  ed(int t, int i, char ty) : target(t), id(i), type(ty){};
};
class ans {
 public:
  int id;
  char type;
  ans(int i, char ty) : id(i), type(ty){};
};
vector<ed> edge[maxn];
vector<ans> answer;
inline int getf(int x) { return f[x] == x ? x : f[x] = getf(f[x]); }
void euler(int x, int in_id, char in_type) {
  for (vector<ed>::iterator vi = edge[x].begin(); vi != edge[x].end(); vi++) {
    if (used[(*vi).id]) continue;
    used[(*vi).id] = true;
    euler((*vi).target, (*vi).id, (*vi).type);
  }
  if (in_id >= 0) answer.push_back(ans(in_id, in_type));
}
int main() {
  cin >> m;
  for (int i = 0; i < n; i++) f[i] = i, deg[i] = 0;
  for (int i = 1, x, y; i <= m; i++) {
    cin >> x >> y;
    deg[x]++;
    deg[y]++;
    edge[x].push_back(ed(y, i, '+'));
    edge[y].push_back(ed(x, i, '-'));
    if (getf(x) == getf(y)) continue;
    f[getf(x)] = getf(y);
    cntblk--;
  }
  int tmp = 0, s = -1;
  for (int i = 0; i < n; i++) {
    cntblk -= (deg[i] == 0);
    tmp += (deg[i] & 1);
    if (deg[i] > 0 && (s == -1 || deg[i] & 1)) s = i;
  }
  if (cntblk != 1 || !(tmp == 0 || tmp == 2)) {
    puts("No solution");
    return 0;
  }
  memset(used, false, sizeof(used));
  euler(s, -1, '+');
  for (vector<ans>::reverse_iterator vi = answer.rbegin(); vi < answer.rend();
       vi++) {
    printf("%d %c\n", (*vi).id, (*vi).type);
  }
  return 0;
}