#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > v[105];
pair<pair<int, int>, double> edge[105];
void dfs(int first, int f, double d) {
  double ti = 2.0 / (v[first].size());
  double now = fmod(d + ti, 2);
  for (auto it : v[first]) {
    if (it.first != f) {
      dfs(it.first, first, fmod(now + 1, 2));
      if (edge[it.second].first.first != first)
        swap(edge[it.second].first.first, edge[it.second].first.second);
      edge[it.second].second = now;
      now = fmod(now + ti, 2);
    }
  }
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    int first, second;
    scanf("%d %d", &first, &second);
    v[first].push_back(make_pair(second, i));
    v[second].push_back(make_pair(first, i));
    edge[i] = make_pair(make_pair(first, second), 0);
  }
  for (int i = 1; i < n; i++) {
    if (v[i].size() == 1) {
      dfs(i, 0, 0);
      break;
    }
  }
  printf("%d\n", n - 1);
  for (int i = 1; i < n; i++) {
    if (edge[i].second >= 1) {
      printf("1 %d %d %d %.12lf\n", i, edge[i].first.first,
             edge[i].first.second, 2 - edge[i].second);
    } else {
      printf("1 %d %d %d %.12lf\n", i, edge[i].first.second,
             edge[i].first.first, 1 - edge[i].second);
    }
  }
}
