#include <bits/stdc++.h>
using namespace std;
const long long maxn = 5e5 + 100;
const long long mod = 1e9 + 7;
const long long base = 1e18;
vector<pair<long long, pair<pair<long long, long long>, long double>>> ans;
vector<pair<long long, long long>> adj[maxn];
void add(long long u, long long v, long double x, long long id) {
  if (x >= 1.0)
    ans.push_back(make_pair(id, make_pair(make_pair(u, v), 1.0 - (x - 1.0))));
  else
    ans.push_back(make_pair(id, make_pair(make_pair(v, u), 1.0 - x)));
}
void dfs(long long u, long long par, long double nw) {
  if (nw >= 2.0) nw -= (2.0);
  long double p = 2.0 / (long double)(adj[u].size());
  if (u != 1) nw += p;
  if (nw >= 2.0) nw -= (2.0);
  for (auto to : adj[u]) {
    long long nxt = to.first;
    long long id = to.second;
    if (nxt == par) continue;
    add(u, nxt, nw, id);
    dfs(nxt, u, nw + 1.0);
    nw += p;
    if (nw >= 2.0) nw -= (2.0);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  if (fopen("TRIPLES.inp", "r")) {
    freopen("TRIPLES.inp", "r", stdin);
    freopen("TRIPLES.out", "w", stdout);
  }
  long long n;
  cin >> n;
  for (int i = 1; i <= n - 1; i++) {
    long long x, y;
    cin >> x >> y;
    adj[x].push_back(make_pair(y, i));
    adj[y].push_back(make_pair(x, i));
  }
  dfs(1, 0, 0.0);
  cout << fixed << setprecision(10);
  cout << ans.size() << "\n";
  for (auto p : ans) {
    cout << 1 << " " << p.first << " " << p.second.first.first << " "
         << p.second.first.second << " " << p.second.second << "\n";
  }
}
