#include <bits/stdc++.h>
using namespace std;
constexpr long double EPS = 1e-9;
constexpr int MAXN = 1e5 + 10;
constexpr int LOGN = 20;
int n;
vector<int> adj[MAXN], id[MAXN];
void dfs(int nv, int p, long double first) {
  first += 1;
  if (first >= 2) first -= 2;
  long double val = 2.0l / ((int)(adj[nv]).size());
  for (int i = (0); i < (((int)(adj[nv]).size())); i++) {
    if (adj[nv][i] == p) continue;
    first += val;
    if (first >= 2) first -= 2;
    int v = nv, u = adj[v][i];
    long double xx = first;
    if (xx > 1) {
      xx -= 1;
      swap(u, v);
    }
    printf("1 %d %d %d %.10f\n", id[nv][i], u + 1, v + 1, (double)xx);
    dfs(adj[nv][i], nv, first);
  }
}
int main() {
  scanf("%d", &n);
  for (int i = (1); i < (n); i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    u--, v--;
    adj[u].emplace_back(v);
    id[u].emplace_back(i);
    adj[v].emplace_back(u);
    id[v].emplace_back(i);
  }
  printf("%d\n", n - 1);
  long double val = 2.0l / ((int)(adj[0]).size());
  long double first = 0;
  for (int i = (0); i < (((int)(adj[0]).size())); i++) {
    int u = adj[0][i], v = 0;
    first += val;
    if (first >= 2) first -= 2;
    long double xx = first;
    if (xx > 1) {
      xx -= 1;
      swap(u, v);
    }
    printf("1 %d %d %d %.10f\n", id[0][i], u + 1, v + 1, (double)xx);
    dfs(adj[0][i], 0, first);
  }
}
