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>
#pragma GCC optimize("O2")
using namespace std;
inline long long input() {
  long long n;
  cin >> n;
  return n;
}
string base2(long long n) {
  string a = "";
  while (n >= 2) {
    a += (char)(n % 2 + '0');
    n /= 2;
  }
  a += (char)(n + '0');
  reverse((a).begin(), (a).end());
  return a;
}
const int MAXN = 1e6 + 10;
const int MOD = 1e9 + 7;
const int MOD2 = 998244353;
const long long INF = 8e18;
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)));
}
vector<pair<int, int>> g[MAXN];
int mark[MAXN], markmoal[MAXN], cnt[MAXN], MOAL = 0;
vector<int> moal[MAXN];
vector<int> ans;
map<pair<int, int>, vector<int>> mp;
void DFSM(int x) {
  moal[MOAL].push_back(x);
  markmoal[x] = 1;
  for (auto y : g[x]) {
    int cu = y.first;
    if (!markmoal[cu]) {
      DFSM(cu);
    }
  }
}
void DFS(int x) {
  for (int i = cnt[x]; i < (int)g[x].size(); i++) {
    pair<int, int> cu = g[x][i];
    int y = cu.first, id = cu.second;
    if (mark[id]) {
      cnt[x]++;
    } else {
      mark[id] = 1;
      cnt[x]++;
      DFS(y);
    }
  }
  ans.push_back(x);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    g[a].push_back({b, i + 1});
    g[b].push_back({a, i + 1});
    mp[make_pair(a, b)].push_back(i + 1);
  }
  vector<int> O;
  int MOAL = 0;
  for (int i = 0; i < 7; i++) {
    if (!markmoal[i] && !g[i].empty()) {
      DFSM(i);
      MOAL++;
    }
    if (g[i].size() % 2) {
      O.push_back(i);
    }
  }
  if (MOAL == 1 && (O.size() == 2 || O.empty())) {
    if (O.empty()) {
      DFS(moal[0][0]);
      for (int i = 1; i < (int)ans.size(); i++) {
        if (!mp[make_pair(ans[i - 1], ans[i])].empty()) {
          cout << mp[make_pair(ans[i - 1], ans[i])].back() << " +";
          cout << "\n";
          mp[make_pair(ans[i - 1], ans[i])].pop_back();
        } else {
          swap(ans[i - 1], ans[i]);
          cout << mp[make_pair(ans[i - 1], ans[i])].back() << " -";
          cout << "\n";
          mp[make_pair(ans[i - 1], ans[i])].pop_back();
          swap(ans[i - 1], ans[i]);
        }
      }
      return 0;
    } else {
      DFS(O[0]);
      for (int i = 1; i < (int)ans.size(); i++) {
        if (!mp[make_pair(ans[i - 1], ans[i])].empty()) {
          cout << mp[make_pair(ans[i - 1], ans[i])].back() << " +";
          cout << "\n";
          mp[make_pair(ans[i - 1], ans[i])].pop_back();
        } else {
          swap(ans[i - 1], ans[i]);
          cout << mp[make_pair(ans[i - 1], ans[i])].back() << " -";
          cout << "\n";
          mp[make_pair(ans[i - 1], ans[i])].pop_back();
          swap(ans[i - 1], ans[i]);
        }
      }
      return 0;
    }
  } else {
    cout << "No solution";
    return 0;
  }
  return 0;
}