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 int N = 500;
long long int n, m, a, b, cnt = 0, t[N], f[N], p[N], seen[N], ma[N], ind, ans;
vector<long long int> v[N], ro, g, e, ve;
void dfs(long long int s, long long int r) {
  while (p[s] < (long long int)v[s].size()) {
    p[s]++;
    if (!seen[v[s][p[s] - 1]]) {
      seen[v[s][p[s] - 1]] = 1;
      dfs(s ^ t[v[s][p[s] - 1]] ^ f[v[s][p[s] - 1]], v[s][p[s] - 1]);
    }
  }
  ve.push_back(s);
  e.push_back(r);
}
void check(long long int s) {
  ma[s] = 1;
  for (auto y : v[s])
    if (ma[s ^ t[y] ^ f[y]] == 0) check(s ^ t[y] ^ f[y]);
}
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> m;
  for (int i = 1; i <= m; i++) {
    cin >> a >> b;
    a++, b++;
    ro.push_back(a), ro.push_back(b);
    t[i] = a, f[i] = b;
    v[a].push_back(i);
    v[b].push_back(i);
  }
  sort(ro.begin(), ro.end());
  ro.resize(unique(ro.begin(), ro.end()) - ro.begin());
  for (int i = 1; i <= 7; i++)
    if (ma[i] == 0 && (long long int)v[i].size() > 0) {
      cnt++, check(i);
    }
  for (int i = 1; i <= 7; i++)
    if (v[i].size() % 2 == 1) g.push_back(i);
  if (g.size() > 2 || cnt > 1) {
    cout << "No solution";
    return 0;
  }
  if ((long long int)g.size() == 2) {
    t[m + 1] = g[0], f[m + 1] = g[1];
    v[g[0]].push_back(m + 1);
    v[g[1]].push_back(m + 1);
  }
  dfs(ro[0], 0);
  ind = 0;
  for (int i = 0; i < e.size(); i++)
    if (e[i] == m + 1) ind = i + 1;
  for (int i = ind; i < e.size() - 1; i++) {
    cout << e[i] << ' ';
    if (ve[i] == t[e[i]] && ve[i + 1] == f[e[i]])
      cout << '+';
    else
      cout << '-';
    cout << '\n';
  }
  for (int i = 0; i < ind - 1; i++) {
    cout << e[i] << ' ';
    if (ve[i] == t[e[i]] && ve[i + 1] == f[e[i]])
      cout << '+';
    else
      cout << '-';
    cout << '\n';
  }
}