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>
const int INF = 2000000005;
const long long BIG_INF = 2000000000000000005;
const int mod = 1000000007;
const int P = 31;
const long double PI = 3.141592653589793238462643;
const double eps = 1e-9;
using namespace std;
vector<pair<int, int>> dir = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}};
bool valid(int x, int y, int n, int m) {
  return x >= 0 && y >= 0 && x < n && y < m;
}
mt19937 rng(1999999973);
int n, deg[7], fake, p[7];
int cl[7][7];
map<pair<int, int>, int> col;
map<pair<int, int>, vector<int>> ind;
pair<int, int> edge[105];
bool used[7];
vector<int> ord;
vector<pair<int, pair<int, int>>> order;
pair<int, int> getP(pair<int, int> e) {
  return make_pair(min(e.first, e.second), max(e.first, e.second));
}
pair<int, int> getP(int x, int y) {
  pair<int, int> e = make_pair(x, y);
  return make_pair(min(e.first, e.second), max(e.first, e.second));
}
int find_set(int v) {
  if (p[v] == v) return v;
  p[v] = find_set(p[v]);
  return p[v];
}
void dfs(int v) {
  int i = v;
  if (cl[v][i] != 0) {
    cl[v][i]--;
    cl[i][v]--;
    dfs(i);
  }
  for (int i = 0; i < 7; i++) {
    if (cl[v][i] != 0) {
      cl[v][i]--;
      cl[i][v]--;
      dfs(i);
    }
  }
  ord.push_back(v);
}
int root = 0;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  for (int i = 0; i < 7; i++) p[i] = i;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int u, v;
    cin >> u >> v;
    deg[u]++, deg[v]++;
    cl[u][v]++;
    cl[v][u]++;
    edge[i] = make_pair(u, v);
    ind[getP(u, v)].push_back(i);
    if (find_set(u) != find_set(v)) p[find_set(u)] = find_set(v);
    used[u] = true;
    used[v] = true;
    root = u;
  }
  for (int i = 0; i < 7; i++) {
    for (int j = 0; j < 7; j++) {
      if (find_set(i) != find_set(j) && used[i] && used[j]) {
        cout << "No solution";
        return 0;
      }
    }
  }
  vector<int> odd;
  for (int i = 0; i < 7; i++) {
    if (deg[i] % 2 == 1) odd.push_back(i);
  }
  if (odd.size() > 2) {
    cout << "No solution";
    return 0;
  }
  if (odd.empty()) {
    dfs(root);
    for (int i = 0; i < ord.size() - 1; i++) {
      order.push_back(make_pair(ind[getP(ord[i], ord[i + 1])].back(),
                                make_pair(ord[i], ord[i + 1])));
      ind[getP(ord[i], ord[i + 1])].pop_back();
    }
    for (int i = 0; i < order.size(); i++) {
      cout << order[i].first + 1 << " ";
      if (order[i].second != edge[order[i].first])
        cout << "-" << '\n';
      else
        cout << "+" << '\n';
    }
  } else {
    int u = odd[0], v = odd[1];
    deg[u]++, deg[v]++;
    cl[u][v]++;
    cl[v][u]++;
    edge[n] = make_pair(u, v);
    ind[getP(u, v)].push_back(n);
    dfs(odd[0]);
    for (int i = 0; i < ord.size() - 1; i++) {
      order.push_back(make_pair(ind[getP(ord[i], ord[i + 1])].back(),
                                make_pair(ord[i], ord[i + 1])));
      ind[getP(ord[i], ord[i + 1])].pop_back();
    }
    while (order[0].first != n) {
      order.push_back(order[0]);
      order.erase(order.begin());
    }
    order.erase(order.begin());
    for (int i = 0; i < order.size(); i++) {
      cout << order[i].first + 1 << " ";
      if (order[i].second != edge[order[i].first])
        cout << "-" << '\n';
      else
        cout << "+" << '\n';
    }
  }
  return 0;
}