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 mod = 1e9 + 7;
struct edge {
  int a, b;
  bool stat;
};
const int n = 7;
vector<vector<pair<int, int> > > g;
vector<edge> edges;
vector<int> res;
int cnt[n];
int get_cnt_odd() {
  int res = 0;
  for (int i = 0; i < n; i++)
    if (cnt[i] % 2 != 0) res++;
  return res;
}
int get_first() {
  for (int i = 0; i < n; i++)
    if (cnt[i]) return i;
  return 0;
}
void search_euler_cycle() {
  stack<int> st;
  st.push(get_first());
  while (!st.empty()) {
    int v = st.top();
    bool break_stat = false;
    for (int j = 0; j < g[v].size(); j++) {
      int to = g[v][j].first, in = g[v][j].second;
      if (edges[in].stat) {
        break_stat = true;
        edges[in].stat = false;
        st.push(to);
        break;
      }
    }
    if (!break_stat) {
      res.push_back(v);
      st.pop();
    }
  }
}
bool no_ans() {
  for (int i = 0; i < n; i++)
    for (int j = 0; j < g[i].size(); j++)
      if (edges[g[i][j].second].stat) return true;
  return false;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int m;
  cin >> m;
  g.resize(n);
  edges.resize(m + 1);
  int count1 = 0;
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    edges[i] = {u, v, true};
    cnt[u]++;
    cnt[v]++;
    if ((u == 6 && v == 2) || (v == 6 && u == 2)) count1++;
    g[u].push_back({v, i});
    g[v].push_back({u, i});
  }
  if (get_cnt_odd() > 2) {
    cout << "No solution"
         << "\n";
    return 0;
  }
  int v1 = -1, v2 = -1;
  for (int i = 0; i < n; i++) {
    if (cnt[i] % 2 != 0 && (v1 == -1 || v2 == -1)) {
      if (v1 == -1)
        v1 = i;
      else
        v2 = i;
    }
  }
  if (v1 != -1) {
    edges[m] = {v1, v2, true};
    g[v1].push_back({v2, m});
    g[v2].push_back({v1, m});
  }
  search_euler_cycle();
  for (int i = 0; i < res.size() - 1; i++) {
    if ((res[i] == v1 && res[i + 1] == v2) ||
        (res[i] == v2 && res[i + 1] == v1)) {
      vector<int> new_res;
      for (int j = i + 1; j < res.size(); j++) new_res.push_back(res[j]);
      for (int j = 0; j <= i; j++) new_res.push_back(res[j]);
      res = new_res;
      break;
    }
  }
  if (no_ans()) {
    cout << "No solution"
         << "\n";
    return 0;
  }
  map<pair<int, int>, stack<int> > op;
  for (int i = 0; i < n; i++) {
    pair<int, int> x = {i, i};
    stack<int> y;
    y.push(-1);
    op.insert(make_pair(x, y));
  }
  for (int i = 0; i < m; i++) {
    pair<int, int> x = {edges[i].a, edges[i].b};
    if (op.find(x) != op.end())
      op[x].push(i);
    else {
      stack<int> y;
      y.push(i);
      op.insert(make_pair(x, y));
    }
  }
  int count2 = 0;
  for (int i = 0; i < res.size() - 1; i++)
    if ((res[i] == 6 && res[i + 1] == 2) || (res[i + 1] == 6 && res[i] == 2))
      count2++;
  for (int i = 0; i < res.size() - 1; i++) {
    pair<int, int> x = {res[i], res[i + 1]};
    auto it = op.find(x);
    bool stat = false;
    if (it == op.end() || it->second.empty()) {
      stat = true;
      swap(x.first, x.second);
      it = op.find(x);
    }
    int in = it->second.top();
    if (in != -1) {
      it->second.pop();
      cout << in + 1 << " " << ((!stat) ? "+" : "-") << "\n";
    }
  }
  return 0;
}