#include <bits/stdc++.h>
using namespace std;
typedef struct {
  int nd, p;
  double val;
} dog;
const int maxn = 105;
int n;
pair<pair<int, int>, pair<int, int> > M[maxn];
vector<dog> ed[maxn];
void DFS(int nd, int pn, int i) {
  double uem = 2 - (ed[pn][i].val < 1 ? 1 - ed[pn][i].val : 3 - ed[pn][i].val);
  for (int i = 0; i < ed[nd].size(); i++) {
    if (ed[nd][i].nd == pn) continue;
    uem += 2.0 / ed[nd].size();
    if (uem > 2.0) uem -= 2.0;
    ed[nd][i].val = uem;
    DFS(ed[nd][i].nd, nd, i);
  }
}
int cmp(double a, double b) { return (fabs(a - b) < 1e-5); }
int main() {
  cin >> n;
  for (int i = 1, a, b; i < n; i++) {
    cin >> a >> b;
    dog aux;
    aux.nd = b, aux.p = i, aux.val = -1;
    ed[a].push_back(aux);
    aux.nd = a;
    ed[b].push_back(aux);
    M[i] = make_pair(make_pair(a, ed[a].size() - 1),
                     make_pair(b, ed[b].size() - 1));
  }
  for (int i = 0; i < ed[1].size(); i++) {
    ed[1][i].val = 2.0 / ed[1].size() * i;
    DFS(ed[1][i].nd, 1, i);
  }
  cout << fixed << setprecision(6) << n - 1 << "\n";
  for (int i = 1; i < n; i++) {
    int u, v;
    double val;
    if (cmp(ed[M[i].first.first][M[i].first.second].val, -1)) {
      u = M[i].second.first;
      v = ed[u][M[i].second.second].nd;
      val = ed[u][M[i].second.second].val;
    } else {
      u = M[i].first.first;
      v = ed[u][M[i].first.second].nd;
      val = ed[u][M[i].first.second].val;
    }
    if (val < 1.0)
      cout << "1 " << i << " " << u << " " << v << " " << val << "\n";
    else
      cout << "1 " << i << " " << v << " " << u << " " << val - 1 << "\n";
  }
  return 0;
}
