#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 111;
int adjMat[MAX_N][MAX_N];
int parent[MAX_N];
int indicesOfEdges[MAX_N][MAX_N];
double pointPosition[MAX_N][MAX_N];
int main() {
  int n;
  int numOfNeighbors;
  double currentPointPosition;
  double displacement;
  queue<int> que;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    u -= 1;
    v -= 1;
    adjMat[u][v] = 1;
    adjMat[v][u] = 1;
    indicesOfEdges[u][v] = i + 1;
    indicesOfEdges[v][u] = i + 1;
  }
  numOfNeighbors = 0;
  for (int i = 0; i < n; i++) {
    if (adjMat[0][i]) {
      numOfNeighbors += 1;
      parent[i] = 0;
      que.push(i);
    }
  }
  currentPointPosition = 0.0;
  displacement = 2.0 / numOfNeighbors;
  for (int i = 0; i < n; i++) {
    if (adjMat[0][i]) {
      currentPointPosition += displacement;
      if (currentPointPosition >= 2.0) currentPointPosition -= 2.0;
      pointPosition[0][i] = currentPointPosition;
      pointPosition[i][0] = currentPointPosition;
    }
  }
  while (!que.empty()) {
    int curNode = que.front();
    que.pop();
    numOfNeighbors = 1;
    for (int child = 0; child < n; child++) {
      if (adjMat[curNode][child] && child != parent[curNode]) {
        parent[child] = curNode;
        numOfNeighbors += 1;
        que.push(child);
      }
    }
    currentPointPosition = pointPosition[curNode][parent[curNode]] + 1.0;
    displacement = 2.0 / numOfNeighbors;
    if (currentPointPosition >= 2.0) currentPointPosition -= 2.0;
    for (int child = 0; child < n; child++) {
      if (adjMat[curNode][child] && child != parent[curNode]) {
        currentPointPosition += displacement;
        if (currentPointPosition >= 2.0) currentPointPosition -= 2.0;
        pointPosition[curNode][child] = currentPointPosition;
        pointPosition[child][curNode] = currentPointPosition;
      }
    }
  }
  cout << (n - 1) << endl;
  for (int i = 1; i < n; i++) {
    int curNode = i;
    int parentNode = parent[curNode];
    double pos = pointPosition[curNode][parentNode];
    printf("1 ");
    printf("%d ", indicesOfEdges[curNode][parentNode]);
    if (pos <= 1.0) {
      printf("%d %d ", parentNode + 1, curNode + 1);
    } else {
      printf("%d %d ", curNode + 1, parentNode + 1);
      pos -= 1.0;
    }
    printf("%.16lf\n", pos);
  }
  return 0;
}
