#include <bits/stdc++.h>
using namespace std;
template <typename X>
void MA(X& a, X b) {
  a = max(a, b);
}
template <typename X>
void MI(X& a, X b) {
  a = min(a, b);
}
template <typename X>
void clr(X& x, int a) {
  memset(x, a, sizeof(x));
};
int cond = 0, multi = 0, gcj = 0;
int N;
const int MAXN = 111;
vector<array<int, 2> > ED[MAXN];
long double wsp[MAXN];
array<int, 3> res[MAXN];
int numkr = 0;
void go(int u, int p, long double val) {
  int kr = 0;
  kr += ED[u].size();
  {
    if (cond)
      cerr << 38 << " "
           << "u << \" \" << kr << \" \" << val"
           << " " << u << " " << kr << " " << val << endl;
  };
  val += 2.0 / kr;
  while (val >= 2.0) val -= 2.0;
  for (array<int, 2> ed : ED[u])
    if (ed[0] != p) {
      int v = ed[0];
      int idx = ed[1];
      {
        if (cond)
          cerr << 45 << " "
               << "u << \" \" << v << \" \" << val"
               << " " << u << " " << v << " " << val << endl;
      };
      go(v, u, 1 + val);
      if (val <= 1.0) {
        res[numkr] = array<int, 3>({v, u, idx});
        wsp[numkr] = 1.0 - val;
      } else {
        res[numkr] = array<int, 3>({u, v, idx});
        wsp[numkr] = 2.0 - val;
      }
      numkr++;
      val += 2.0 / kr;
      while (val >= 2.0) val -= 2.0;
    }
}
void solve() {
  cin >> N;
  for (auto i = (1); i <= (N - 1); ++i) {
    int u, v;
    cin >> u >> v;
    ED[u].push_back(array<int, 2>({v, i}));
    ED[v].push_back(array<int, 2>({u, i}));
  }
  go(1, -1, 0);
  cout << N - 1 << "\n";
  for (auto i = 0; i < (N - 1); ++i) {
    cout << 1 << " " << res[i][2] << " " << res[i][0] << " " << res[i][1] << " "
         << wsp[i] << "\n";
  }
}
int main(int argc, char** argv) {
  ios::sync_with_stdio(false), cin.tie(0),
      cond = argc >= 2 && argv[1][0] == 'q' ? 1 << 30 : 0;
  cout.setf(ios::fixed), cout.precision(10);
  int t;
  if (multi || gcj)
    cin >> t;
  else
    t = 1;
  for (auto i = (1); i <= (t); ++i) {
    if (cond) cerr << 84 << " " << i << endl;
    if (gcj) cout << "Case #" << i << ": ";
    solve();
  }
  return 0;
}
