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>
#pragma GCC optimize("Ofast")
using namespace std;
vector<vector<int> > g, loops;
int n;
vector<int> ans, vis, loop_vis;
vector<pair<int, int> > dom;
int fin = -1, ok = 1;
void dfs(int u) {
  if (!loop_vis[u]) {
    loop_vis[u] = 1;
    for (int e : loops[u]) {
      vis[e] = 1;
      ans.push_back(e);
    }
  }
  for (int e : g[u]) {
    int v = dom[e].first == u ? dom[e].second : dom[e].first;
    if (v != fin && !vis[e]) {
      ans.push_back(e);
      vis[e] = 1;
      dfs(v);
      return;
    }
  }
  for (int e : g[u]) {
    int v = dom[e].first == u ? dom[e].second : dom[e].first;
    if (v == fin && !vis[e]) {
      ans.push_back(e);
      vis[e] = 1;
      dfs(v);
      return;
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  g.assign(7, vector<int>());
  loops.assign(7, vector<int>());
  dom.resize(n);
  vis.assign(n, 0);
  loop_vis.assign(7, 0);
  int st = -1;
  for (int i = 0; i < n; ++i) {
    cin >> dom[i].first >> dom[i].second;
    st = dom[i].first;
    if (dom[i].first == dom[i].second)
      loops[dom[i].first].push_back(i);
    else {
      g[dom[i].first].push_back(i);
      g[dom[i].second].push_back(i);
    }
  }
  int odd = 0;
  for (int j = 0; j < 7; ++j) {
    if (g[j].size() & 1) {
      odd++;
      fin = st;
      st = j;
    }
    if (st == -1 && g[j].size()) st = j;
  }
  if (odd > 2) ok = 0;
  if (odd < 2) fin = -1;
  dfs(st);
  for (int i : vis)
    if (!i) ok = 0;
  if (!ok) {
    cout << "No solution\n";
    return 0;
  }
  for (int k = 0; k < n; ++k) {
    cout << ans[k] + 1 << " ";
    if (dom[ans[k]].first == st) {
      cout << "+\n";
      st = dom[ans[k]].second;
    } else {
      cout << "-\n";
      st = dom[ans[k]].first;
    }
  }
}