#include <bits/stdc++.h>
using namespace std;
inline void rdl(long long &val) {
  long long x = 0;
  int f = 1;
  char ch = getchar();
  while ((ch < '0' or ch > '9') and ch != '-') ch = getchar();
  if (ch == '-') {
    f = -1;
    ch = getchar();
  }
  while (ch >= '0' and ch <= '9') {
    x = (x << 3) + (x << 1) + ch - '0';
    ch = getchar();
  }
  val = x * f;
}
inline void rdi(int &val) {
  int x = 0;
  int f = 1;
  char ch = getchar();
  while ((ch < '0' or ch > '9') and ch != '-') ch = getchar();
  if (ch == '-') {
    f = -1;
    ch = getchar();
  }
  while (ch >= '0' and ch <= '9') {
    x = (x << 3) + (x << 1) + ch - '0';
    ch = getchar();
  }
  val = x * f;
}
inline long long rdl() {
  long long x = 0;
  int f = 1;
  char ch = getchar();
  while ((ch < '0' or ch > '9') and ch != '-') ch = getchar();
  if (ch == '-') {
    f = -1;
    ch = getchar();
  }
  while (ch >= '0' and ch <= '9') {
    x = (x << 3) + (x << 1) + ch - '0';
    ch = getchar();
  }
  return x * f;
}
inline int rdi() {
  int x = 0;
  int f = 1;
  char ch = getchar();
  while ((ch < '0' or ch > '9') and ch != '-') ch = getchar();
  if (ch == '-') {
    f = -1;
    ch = getchar();
  }
  while (ch >= '0' and ch <= '9') {
    x = (x << 3) + (x << 1) + ch - '0';
    ch = getchar();
  }
  return x * f;
}
inline void write(int x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
inline void _write(int x) {
  write(x);
  putchar(' ');
}
inline void print(int x) {
  write(x);
  putchar('\n');
}
inline void write(long long x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
inline void _write(long long x) {
  write(x);
  putchar(' ');
}
inline void print(long long x) {
  write(x);
  putchar('\n');
}
vector<int> g[1111];
int n;
double t[1111];
map<pair<int, int>, int> id;
inline void dfs(int x, int par) {
  int sz = g[x].size();
  double ans = (par == 0) ? 0 : 1 + t[x], td = 2.0 / sz;
  for (int y : g[x])
    if (y != par) {
      ans += td;
      while (ans >= 2.0) ans -= 2.0;
      t[y] = ans;
      printf("1 %d ", id[make_pair(x, y)]);
      if (ans < 1)
        printf("%d %d %.6f\n", x, y, ans);
      else
        printf("%d %d %.6f\n", y, x, ans - 1.0);
      dfs(y, x);
    }
}
int main() {
  rdi(n);
  int i, j, x, y;
  for (i = 1; i < n; ++i) {
    rdi(x), rdi(y);
    id[make_pair(x, y)] = id[make_pair(y, x)] = i;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  print(n - 1);
  dfs(1, 0);
  return 0;
}
