#include <bits/stdc++.h>
using namespace std;
const double PI =
    3.14159265358979323846264338327950288419716939937510582097494459230;
template <typename T>
inline T gcd(T a, T b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
template <typename T>
inline void amin(T& x, T y) {
  if (x > y) x = y;
}
template <typename T>
inline void amax(T& x, T y) {
  if (x < y) x = y;
}
int n;
vector<vector<pair<int, int>>> tree;
vector<pair<pair<int, int>, double>> ans;
void preprocess(void) { return; }
void MODdfs(int u, int p) {
  int deg = tree[u].size();
  double al = 0.0;
  if (p != -1) {
    for (int i = (0); i <= ((int)((int)tree[u].size()) - 1); i++) {
      if (tree[u][i].first == p) {
        al = ans[tree[u][i].second].second;
        if (ans[tree[u][i].second].first.first == p) {
          al = 1.0 - al;
        } else {
          al = 2.0 - al;
        }
        break;
      }
    }
  }
  int ind = 1;
  for (int i = (0); i <= ((int)((int)tree[u].size()) - 1); i++) {
    int v = tree[u][i].first;
    if (v == p) {
      continue;
    }
    if (p == -1) {
      double tans = 2.0 * (double)i / (double)deg;
      if (tans < 1.0) {
        ans[tree[u][i].second] = {{u, v}, tans};
      } else {
        ans[tree[u][i].second] = {{v, u}, tans - 1.0};
      }
    } else {
      double tans = al + 2.0 * ind / deg;
      ;
      if (tans >= 2.0) {
        tans -= 2.0;
      }
      tans = 2 - tans;
      ind++;
      if (tans < 1.0) {
        ans[tree[u][i].second] = {{u, v}, tans};
      } else {
        ans[tree[u][i].second] = {{v, u}, tans - 1.0};
      }
    }
    MODdfs(v, u);
  }
}
int main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.precision(20);
  preprocess();
  int t;
  t = 1;
  for (int z = (1); z <= (t); z++) {
    cin >> n;
    tree.resize(n);
    ans.resize(n - 1);
    for (int i = (0); i <= ((int)(n - 1) - 1); i++) {
      int u, v;
      cin >> u >> v;
      u--, v--;
      tree[u].push_back({v, i});
      tree[v].push_back({u, i});
    }
    MODdfs(0, -1);
    cout << n - 1 << endl;
    for (int i = (0); i <= ((int)(n - 1) - 1); i++) {
      cout << 1 << ' ' << (i + 1) << ' ' << (ans[i].first.first + 1) << ' '
           << (ans[i].first.second + 1) << ' ' << ans[i].second << endl;
    }
  }
  return 0;
}
