#include <bits/stdc++.h>
using namespace std;
struct Edge {
  int to, len, next;
} f[10010 << 1];
int head[10010], l = 0, u, v, n, fa[10010], id[10010], dg[10010];
double t[10010];
void Dfs(int u, int pa) {
  double now = t[u];
  double tmp = 2.0 / dg[u];
  for (int i = head[u]; i; i = f[i].next)
    if (f[i].to != pa) {
      int v = f[i].to;
      fa[v] = u;
      id[v] = f[i].len;
      t[v] = fmod((now += tmp) + 1.0, 2.0);
      Dfs(v, u);
    }
}
int main() {
  cin >> n;
  for (int i = 1; i < n; i++) {
    scanf("%d%d", &u, &v);
    ({
      f[++l] = (Edge){v, i, head[u]};
      head[u] = l;
    });
    ({
      f[++l] = (Edge){u, i, head[v]};
      head[v] = l;
    });
    dg[u]++;
    dg[v]++;
  }
  Dfs(1, 0);
  printf("%d\n", n - 1);
  for (int i = 2; i <= n; i++) {
    printf("%d %d ", 1, id[i]);
    if (t[i] < 1)
      printf("%d %d %.10lf", i, fa[i], t[i]);
    else
      printf("%d %d %.10lf", fa[i], i, t[i] - 1);
    putchar('\n');
  }
  return 0;
}
