#include <bits/stdc++.h>
using namespace std;
const int INF = (int)1E9;
int N, deg[105];
vector<int> adj[105];
map<pair<int, int>, int> edgeIndex;
map<pair<int, int>, pair<int, double> > ans;
void dfs(int x, int p, int pdir, double poffset) {
  double delta = 2.0 / deg[x], lastOffset = poffset;
  int lastdir = pdir;
  for (int i = (0); i < (adj[x].size()); i++) {
    int y = adj[x][i];
    if (y == p) continue;
    if (delta == 2) {
      assert(x == 0);
      lastOffset = 0;
      lastdir = x;
    } else {
      lastOffset += delta;
      if (lastOffset >= 1 - 1e-9) {
        lastOffset -= 1;
        if (lastOffset < 0) lastOffset = 0;
        lastdir = lastdir == x ? y : x;
      }
    }
    if (lastdir != x && lastdir != y) lastdir = y;
    ans[pair<int, int>(x, y)] = make_pair(lastdir, lastOffset);
    dfs(y, x, lastdir, lastOffset);
  }
}
int main() {
  cin >> N;
  for (int i = (0); i < (N - 1); i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    a--;
    b--;
    adj[a].push_back(b);
    adj[b].push_back(a);
    if (a > b) swap(a, b);
    edgeIndex[pair<int, int>(a, b)] = i;
    deg[a]++;
    deg[b]++;
  }
  dfs(0, -1, 0, 0);
  cout << N - 1 << endl;
  for (auto it = ans.begin(); it != ans.end(); it++) {
    int a = it->first.first, b = it->first.second;
    if (a > b) swap(a, b);
    printf("1 %d ", edgeIndex[pair<int, int>(a, b)] + 1);
    if (it->second.first == a)
      printf("%d %d ", b + 1, a + 1);
    else
      printf("%d %d ", a + 1, b + 1);
    printf("%.9f\n", it->second.second);
  }
  return 0;
}
