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;
long long poww(long long a, long long b, long long md) {
  return (!b ? 1
             : (b & 1 ? a * poww(a * a % md, b / 2, md) % md
                      : poww(a * a % md, b / 2, md) % md));
}
const long long MAXN = 1e6 + 10;
const long long INF = 8e18;
const long long MOD = 1e9 + 7;
int n, vis[MAXN], vis2[MAXN];
vector<pair<pair<int, int>, int>> adj[MAXN];
vector<pair<int, int>> ans;
void dfs(int v, int ind, int dir) {
  while (!adj[v].empty()) {
    pair<pair<int, int>, int> e = adj[v].back();
    adj[v].pop_back();
    if (vis[e.first.second]) continue;
    vis[e.first.second] = true;
    dfs(e.first.first, e.first.second, e.second);
  }
  ans.push_back({ind, 1 - dir});
}
void dfs2(int v) {
  vis2[v] = true;
  for (auto e : adj[v]) {
    if (!vis2[e.first.first]) dfs2(e.first.first);
  }
}
inline char cv(int x) {
  if (x == 0) return '-';
  return '+';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int u, v;
    cin >> u >> v;
    adj[u].push_back({{v, i}, 1});
    adj[v].push_back({{u, i}, 0});
  }
  for (int i = 0; i <= 6; i++) {
    if (!adj[i].empty()) {
      dfs2(i);
      for (int j = 1; j <= 6; j++)
        if (!adj[j].empty() && !vis2[j])
          return cout << "No solution" << '\n', 0;
      break;
    }
  }
  pair<int, int> odd_edge = {10, 10};
  for (int i = 0; i <= 6; i++) {
    if (adj[i].size() & 1) {
      if (odd_edge.first == 10)
        odd_edge.first = i;
      else if (odd_edge.second == 10)
        odd_edge.second = i;
      else
        return cout << "No solution" << '\n', 0;
    }
  }
  adj[odd_edge.first].push_back({{odd_edge.second, n + 10}, 1});
  adj[odd_edge.second].push_back({{odd_edge.first, n + 10}, 0});
  for (int i = 0; i <= 6; i++) {
    if (!adj[i].empty()) {
      dfs(i, n + 5, 0);
      break;
    }
  }
  int bad_ind = -1, bad_ind_val = -1;
  for (int i = 0; i < ans.size(); i++)
    if (ans[i].first > bad_ind_val) bad_ind = i, bad_ind_val = ans[i].first;
  for (int i = bad_ind + 1; i < ans.size(); i++)
    if (ans[i].first <= n)
      cout << ans[i].first << ' ' << cv(ans[i].second) << '\n';
  for (int i = 0; i < bad_ind; i++)
    if (ans[i].first <= n)
      cout << ans[i].first << ' ' << cv(ans[i].second) << '\n';
  return 0;
}