#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
const int MAXN = 105;
const double eps = 1e-9;
vector<int> edge[MAXN];
int eid[MAXN][MAXN];
double rec[MAXN][MAXN];
pair<int, int> path[MAXN];
inline void dfs(int u, int par, double x) {
  rec[par][u] = x;
  int sz = edge[u].size();
  for (auto v : edge[u]) {
    if (par == v) continue;
    x += 2.0 / sz;
    if (x >= 2) x -= 2;
    dfs(v, u, (x + 1) >= 2 ? x - 1 : x + 1);
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL), cout.tie(NULL);
  int n;
  cin >> n;
  for (register int i = (1); i <= (n - 1); ++i) {
    int u, v;
    cin >> u >> v;
    edge[u].push_back(v);
    edge[v].push_back(u);
    path[i].first = u;
    path[i].second = v;
  }
  for (register int i = (1); i <= (n); ++i) {
    for (register int j = (1); j <= (n); ++j) {
      rec[i][j] = -1;
    }
  }
  cout << n - 1 << '\n';
  dfs(1, 0, 0);
  for (register int i = (1); i <= (n - 1); ++i) {
    int u = path[i].first;
    int v = path[i].second;
    if (rec[u][v] < 0) swap(u, v);
    if (rec[u][v] < 1) {
      cout << 1 << ' ' << i << ' ';
      cout << u << ' ' << v << ' ';
      cout << fixed << setprecision(9) << rec[u][v] << '\n';
    } else {
      cout << 1 << ' ' << i << ' ';
      cout << v << ' ' << u << ' ';
      cout << fixed << setprecision(9) << rec[u][v] - 1 << '\n';
    }
  }
  return 0;
}
