#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1);
const int N = 110;
int n;
vector<vector<int> > g;
pair<int, int> p[N];
double d[N][N];
void dfs(int u, int fa, double up) {
  int deg = g[u].size();
  int id = 1;
  for (int i = 0; i < deg; i++) {
    int v = g[u][i];
    if (v == fa) continue;
    d[u][v] = up + id * 2.0 / deg;
    if (d[u][v] > 2) d[u][v] -= 2;
    id++;
    if (d[u][v] < 1)
      d[v][u] = 1 + d[u][v];
    else
      d[v][u] = d[u][v] - 1;
    dfs(v, u, d[v][u]);
  }
}
void solve() {
  dfs(1, -1, 0);
  cout << n - 1 << endl;
  for (int i = 0; i < n - 1; i++) {
    int u = p[i].first, v = p[i].second;
    if (d[u][v] < 1)
      printf("1 %d %d %d %.8f\n", i + 1, u, v, d[u][v]);
    else
      printf("1 %d %d %d %.8f\n", i + 1, v, u, d[u][v] - 1);
  }
}
int main() {
  while (cin >> n) {
    g.clear();
    g.resize(n + 1);
    int u, v;
    for (int i = 0; i < n - 1; i++) {
      scanf("%d %d", &u, &v);
      p[i] = make_pair(u, v);
      g[u].push_back(v);
      g[v].push_back(u);
    }
    solve();
  }
  return 0;
}
