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;
template <typename T, typename S>
inline bool REMIN(T &a, const S &b) {
  return a > b ? a = b, 1 : 0;
}
template <typename T, typename S>
inline bool REMAX(T &a, const S &b) {
  return a < b ? a = b, 1 : 0;
}
int toint(const string &s) {
  stringstream ss;
  ss << s;
  int x;
  ss >> x;
  return x;
}
string tostring(int number) {
  stringstream ss;
  ss << number;
  return ss.str();
}
int bit(long long x, int pos) { return ((1ll << pos) & x) ? 1 : 0; }
const int INF = 1e9;
const int NMAX = 1e5 + 5;
const long long MOD = 1000000007;
const long double PI = 2 * acos(0);
long long power(long long base, long long exp, long long c = MOD) {
  if (!exp) return 1;
  long long r = power(base, exp / 2, c);
  r = (r * r) % c;
  if (exp & 1) r = (r * base) % c;
  return r;
}
int T, N, M;
int a, b, c;
string s1, s2;
void nope(int dec = 0) {
  if (!dec) cout << "NO";
  exit(0);
}
int num[10][10];
int ans[104];
int out[10];
vector<int> cn[10][10];
int tim = 0;
int dfs(int u) {
  for (int(v) = int(0); (v) <= int(9); ++(v)) {
    if (num[u][v]) {
      num[u][v]--;
      num[v][u]--;
      dfs(v);
    }
  }
  tim++;
  ans[tim] = u;
}
int vis[10];
void ch(int curr) {
  vis[curr] = 1;
  for (int(i) = int(0); (i) <= int(9); ++(i))
    if (num[curr][i] && !vis[i]) ch(i);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> N;
  int ori;
  for (int(i) = int(1); (i) <= int(N); ++(i)) {
    cin >> a >> b;
    out[a]++;
    out[b]++;
    cn[a][b].push_back(i);
    num[a][b]++, num[b][a]++;
    ori = a;
  }
  int flag = 0;
  ch(ori);
  for (int(i) = int(0); (i) <= int(9); ++(i))
    if (out[i] && !vis[i]) flag = 1;
  int od = 0;
  for (int(i) = int(0); (i) <= int(9); ++(i))
    if (out[i] & 1) {
      od++;
      ori = i;
    }
  if (od != 2 && od != 0 || flag)
    cout << "No solution";
  else {
    dfs(ori);
    for (int(i) = int(1); (i) <= int(N); ++(i)) {
      int u = ans[i], v = ans[i + 1];
      if (((int)(cn[u][v].size()))) {
        cout << cn[u][v].back() << " +\n";
        cn[u][v].pop_back();
      } else {
        cout << cn[v][u].back() << " -\n";
        cn[v][u].pop_back();
      }
    }
  }
  return 0;
}