#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int SIZE = 1e6 + 10;
vector<pair<int, int> > e[SIZE];
int an[SIZE][2];
double res[SIZE];
double inv(double x) {
  x += 1;
  if (x >= 2) x -= 2;
  return x;
}
void dfs(int x, int lt, double v) {
  int num = ((int)(e[x]).size());
  int it = 1;
  for (int i = 0; i < (((int)(e[x]).size())); ++i) {
    int y = e[x][i].first;
    if (y == lt) continue;
    int eid = e[x][i].second;
    double v2 = (v + it * 2. / num);
    it++;
    if (v2 >= 2) v2 -= 2;
    if (v2 < 1) {
      an[eid][0] = x;
      an[eid][1] = y;
      res[eid] = v2;
    } else {
      an[eid][0] = y;
      an[eid][1] = x;
      res[eid] = inv(v2);
    }
    dfs(y, x, inv(v2));
  }
}
int main() {
  int(n);
  scanf("%d", &n);
  for (int i = (1); i < (n); ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    e[x].push_back(make_pair(y, i));
    e[y].push_back(make_pair(x, i));
  }
  dfs(1, 1, 0.049);
  printf("%d\n", n - 1);
  for (int i = (1); i < (n); ++i) {
    printf("1 %d %d %d %.12f\n", i, an[i][0], an[i][1], res[i]);
  }
  return 0;
}
