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 int N = 110;
struct Edge {
  int u, v;
  Edge(int u = 0, int v = 0) : u(u), v(v) {}
  int to(int x) {
    if (u == x) return v;
    return u;
  }
} E[N];
vector<int> con[N];
vector<pair<int, int>> ans[10];
pair<int, int> pos[N];
int vis[N], visT;
int dfs(int u) {
  vis[u] = visT;
  int res = con[u].size() % 2;
  for (int e : con[u]) {
    int v = E[e].to(u);
    if (!vis[v]) res += dfs(v);
  }
  return res;
}
void dfs1(int u, int id) {
  for (int e : con[u])
    if (!vis[e]) {
      int v = E[e].to(u);
      vis[e] = 1;
      dfs1(v, id);
      ans[id].emplace_back(e, E[e].u == v);
    }
}
int main() {
  ios_base::sync_with_stdio(0);
  int n, nn;
  cin >> n;
  nn = n;
  for (int i = 1; i <= n; i++) {
    cin >> E[i].u >> E[i].v;
    E[i].u++, E[i].v++;
    con[E[i].u].push_back(i), con[E[i].v].push_back(i);
  }
  for (int i = 1; i <= 7; i++)
    if (!vis[i]) {
      visT++;
      int cnt = dfs(i);
      if (cnt > 0 && cnt != 2) {
        cout << "No solution" << endl;
        return 0;
      }
      if (cnt == 2) {
        int u = 0, v = 0;
        for (int i = 1; i <= 7; i++)
          if (vis[i] == visT && con[i].size() & 1) {
            if (u == 0)
              u = i;
            else
              v = i;
          }
        E[++n] = Edge(u, v);
        con[u].push_back(n), con[v].push_back(n);
      }
    }
  memset(vis, 0, sizeof vis);
  for (int i = 1; i <= 7; i++) dfs1(i, i);
  int cur_pos = 0, nnn = 0;
  for (int ii = 1; ii <= 7; ii++) {
    int st = 0;
    if (ans[ii].size()) nnn++;
    for (int i = 0; i < ans[ii].size(); i++)
      if (ans[ii][i].first > nn) {
        st = i;
        break;
      }
    for (int i = 0; i < ans[ii].size(); i++) {
      int u = (st + i) % ans[ii].size();
      if (ans[ii][u].first > nn) continue;
      cur_pos++;
      pos[cur_pos] = ans[ii][u];
    }
  }
  if (nnn > 1) {
    cout << "No solution" << endl;
    return 0;
  }
  for (int i = 1; i <= nn; i++)
    cout << pos[i].first << " "
         << "-+"[pos[i].second] << endl;
  return 0;
}