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 maxn = 10e5 + 10;
const long double SADAT = 7.84e-17;
const long long INF = 1e9;
const long long mod = 1e9 + 7;
const long double PI = 4 * atan((long double)1);
template <class T>
bool checkmin(T &a, T b) {
  return a > b ? a = b, 1 : 0;
}
long long pw(long long a, long long b) {
  return (!b ? 1
             : (b & 1 ? a * pw(a * a % mod, b / 2) % mod
                      : pw(a * a % mod, b / 2) % mod));
}
vector<int> vec[maxn];
bool mark[101][101];
int n;
int p[maxn];
set<pair<int, int> > st;
vector<int> ans;
stack<int> dom[7][7];
int yal[7][7];
long long sum = 0;
void dfs(int v) {
  for (int u = 0; u <= 6; u++) {
    if (yal[u][v]) {
      yal[u][v]--;
      yal[v][u]--;
      sum -= 2;
      dfs(u);
    }
  }
  ans.push_back(v);
  ;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  memset(yal, 0, sizeof yal);
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    vec[x].push_back(y);
    ;
    vec[y].push_back(x);
    ;
    st.insert(make_pair(x, y));
    dom[x][y].push(i + 1);
    yal[x][y]++;
    yal[y][x]++;
    sum += 2;
  }
  bool f = 1;
  int cnt = 0;
  int pis;
  for (int i = 0; i <= 6; i++) {
    if (f and vec[i].size() % 2) {
      cnt++;
      pis = i;
    }
  }
  if (cnt > 0) {
    if (cnt > 2) {
      cout << "No solution";
      return (0);
      ;
    }
    dfs(pis);
    f = 0;
  }
  if (f == 1) {
    for (int i = 0; i <= 6; i++) {
      if (f and vec[i].size()) {
        dfs(i);
        f = 0;
        break;
      }
    }
  }
  if (sum > 0) {
    cout << "No solution";
    return (0);
    ;
  }
  for (int i = 0; i < ans.size() - 1; i++) {
    if (!dom[ans[i]][ans[i + 1]].empty()) {
      cout << dom[ans[i]][ans[i + 1]].top();
      dom[ans[i]][ans[i + 1]].pop();
      cout << " +" << '\n';
    } else if (!dom[ans[i + 1]][ans[i]].empty()) {
      cout << dom[ans[i + 1]][ans[i]].top();
      dom[ans[i + 1]][ans[i]].pop();
      cout << " -" << '\n';
    }
  }
  return (0);
}