#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
vector<std::vector<std::pair<int, int> > > nb;
std::vector<double> mom;
void pr(int u, int v, int ind, double mu) {
  while (mu >= 2) mu -= 2;
  while (mu < 0) mu += 2;
  printf("1 %d ", ind + 1);
  if (mu < 1)
    printf("%d %d %.10lf\n", v + 1, u + 1, 1 - mu);
  else
    printf("%d %d %.10lf\n", u + 1, v + 1, 2 - mu);
}
void dfs(int v, int p) {
  if (v == 0) {
    int k = nb[v].size();
    for (int i = 0; i < k; i++) {
      auto u = nb[v][i];
      pr(0, u.first, u.second,
         (long double)i * (long double)2. / (long double)k);
      mom[u.first] = 1 + (long double)i * (long double)2. / (long double)k;
      if (mom[u.first] >= 2) mom[u.first] -= 2;
    }
  } else {
    int k = nb[v].size();
    int ki = 0;
    long double s = mom[v];
    for (int i = 0; i < k; i++) {
      auto u = nb[v][i];
      if (u.first == p) continue;
      ki++;
      pr(v, u.first, u.second,
         s + (long double)ki * (long double)2. / (long double)k);
      mom[u.first] = 1 + s + (long double)ki * (long double)2. / (long double)k;
      while (mom[u.first] >= 2) mom[u.first] -= 2;
    }
  }
  for (auto u : nb[v]) {
    if (u.first != p) dfs(u.first, v);
  }
}
int main() {
  int n;
  cin >> n;
  nb.resize(n);
  mom.resize(n);
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    nb[u].push_back(make_pair(v, i));
    nb[v].push_back(make_pair(u, i));
  }
  printf("%d\n", n - 1);
  dfs(0, -1);
}
