#include <bits/stdc++.h>
using namespace std;
const int N = 105;
struct Path {
  int id, u, v;
  long double dist;
  Path() {}
  Path(int id, int u, int v, long double dist) : id(id) {
    if (dist >= 1) {
      swap(u, v);
      dist -= 1;
    }
    this->dist = dist;
    this->u = u;
    this->v = v;
  }
};
vector<pair<int, int> > g[N];
vector<Path> ans;
void dfs(int v, int from = -1, long double dist = 0) {
  long double delta = 2;
  delta /= g[v].size();
  for (int i = 0; i < g[v].size(); i++) {
    int to = g[v][i].first, id = g[v][i].second;
    if (to == from) continue;
    dist += delta;
    while (dist >= 2) dist -= 2;
    ans.push_back(Path(id, v, to, dist));
    dfs(to, v, dist >= 1 ? dist - 1 : dist + 1);
  }
}
int main() {
  int n;
  cin >> n;
  for (int i = 1; i < n; i++) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    g[v].push_back(make_pair(u, i));
    g[u].push_back(make_pair(v, i));
  }
  dfs(0);
  cout << n - 1 << "\n";
  for (int i = 0; i < n - 1; i++) {
    cout << "1 " << ans[i].id << " " << ans[i].u + 1 << " " << ans[i].v + 1
         << " ";
    cout << fixed << setprecision(10) << ans[i].dist << "\n";
  }
  return 0;
}
