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 long long INF = 1e9 + 7;
const int N = 2e1 + 10;
vector<int> v[N][N];
int cnt[N][N];
int deg[N];
int flag[N];
class UnionSet {
 public:
  int fa[N];
  void init(int n = N) { memset(fa, -1, sizeof(int) * n); }
  int treesize(int x) { return -fa[Find(x)]; }
  int Find(int x) {
    int root = x;
    while (fa[root] >= 0) root = fa[root];
    while (x != root) {
      int tmp = fa[x];
      fa[x] = root;
      x = tmp;
    }
    return root;
  }
  void Union(int x, int y) {
    int px = Find(x);
    int py = Find(y);
    if (fa[px] > fa[py]) swap(px, py);
    int sz = fa[px] + fa[py];
    fa[py] = px;
    fa[px] = sz;
  }
} uf;
vector<pair<int, int>> ans;
void dfs(int x) {
  for (int i = 0; i <= 6; i++) {
    if (i == x && cnt[i][i] > 0) {
      cnt[x][x]--;
      dfs(x);
      ans.emplace_back(x, x);
      continue;
    }
    if (cnt[x][i]) {
      cnt[x][i]--;
      cnt[i][x]--;
      dfs(i);
      ans.emplace_back(x, i);
    }
  }
}
int main() {
  int n;
  cin >> n;
  uf.init();
  int x = 0, y = 0;
  for (int i = 1; i <= n; i++) {
    cin >> x >> y;
    flag[x] = flag[y] = 1;
    if (x == y) {
      cnt[x][x]++;
      v[x][x].push_back(i);
      continue;
    }
    cnt[x][y]++;
    cnt[y][x]++;
    deg[x]++;
    deg[y]++;
    v[x][y].push_back(i);
    if (uf.Find(x) != uf.Find(y)) uf.Union(x, y);
  }
  int key = x;
  int tot = 0;
  int err = 0;
  for (int i = 0; i <= 6; i++) {
    if (flag[i]) tot++;
    if (deg[i] & 1) key = i, err++;
  }
  if (uf.treesize(x) != tot || err > 2) {
    puts("No solution");
    return 0;
  }
  dfs(key);
  reverse(ans.begin(), ans.end());
  for (auto& p : ans) {
    int x, y;
    tie(x, y) = p;
    if (!v[x][y].empty()) {
      printf("%d +\n", v[x][y].back());
      v[x][y].pop_back();
    } else {
      printf("%d -\n", v[y][x].back());
      v[y][x].pop_back();
    }
  }
  return 0;
}