#include <bits/stdc++.h>
using namespace std;
vector<int> vec[102];
bool chk[102];
int ed[102][102];
void dfs(int v, double w) {
  chk[v] = true;
  for (int i = 0; i < vec[v].size(); i++) {
    int u = vec[v][i];
    if (chk[u]) continue;
    w += 2 / (double)vec[v].size();
    if (w >= 2) w -= 2;
    if (w < 1) {
      printf("1 %d %d %d %.7lf\n", ed[v][u], v, u, w);
    } else {
      printf("1 %d %d %d %.7lf\n", ed[u][v], u, v, w - 1);
    }
    dfs(u, w + 1);
  }
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1, a, b; i < n; i++) {
    scanf("%d %d", &a, &b);
    ed[a][b] = ed[b][a] = i;
    vec[a].push_back(b);
    vec[b].push_back(a);
  }
  printf("%d\n", n - 1);
  dfs(1, 0.0);
}
