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;
int V, E;
int from[210], to[210];
vector<int> edge[10];
stack<int> st;
bool used[210];
vector<int> ans;
bool euler(void) {
  int i;
  int odd = 0;
  for ((i) = 0; (i) < (int)(7); (i)++)
    if (edge[i].size() % 2 != 0) odd++;
  if (odd > 2) return false;
  for ((i) = 0; (i) < (int)(7); (i)++)
    if (!edge[i].empty())
      if (edge[i].size() % 2 != 0 || odd == 0) break;
  int x = i;
  while (!st.empty()) st.pop();
  for ((i) = 0; (i) < (int)(E); (i)++) used[i] = false;
  while (1) {
    int e = -1;
    for ((i) = 0; (i) < (int)(edge[x].size()); (i)++) {
      int e2 = edge[x][i];
      if (!used[e2]) {
        e = e2;
        break;
      }
    }
    if (e == -1) {
      if (st.empty()) break;
      int e2 = st.top();
      st.pop();
      ans.push_back(e2);
      x = from[e2];
    } else {
      st.push(e);
      used[e] = used[e ^ 1] = true;
      x = to[e];
    }
  }
  if (ans.size() != E / 2) return false;
  reverse(ans.begin(), ans.end());
  return true;
}
int main(void) {
  int N, x, y, i;
  cin >> N;
  for ((i) = 0; (i) < (int)(N); (i)++) {
    cin >> x >> y;
    from[E] = x;
    to[E] = y;
    edge[x].push_back(E);
    E++;
    from[E] = y;
    to[E] = x;
    edge[y].push_back(E);
    E++;
  }
  V = 7;
  if (!euler()) {
    cout << "No solution" << endl;
    return 0;
  }
  for ((i) = 0; (i) < (int)(E / 2); (i)++) {
    int e = ans[i];
    cout << e / 2 + 1 << ' ' << ((e % 2 == 0) ? '+' : '-') << endl;
  }
  return 0;
}