#include <bits/stdc++.h>
using namespace std;
vector<int> day;
void dfs(int src, vector<vector<pair<int, int>>> &adj, vector<bool> &vis,
         int dont = -1, int par = -1) {
  vis[src] = true;
  int cur = 1;
  for (auto &x : adj[src]) {
    int dest = x.first, roadIndex = x.second;
    if (dest == par) continue;
    if (cur == dont) cur++;
    day[roadIndex] = cur;
    dfs(dest, adj, vis, cur, src);
    cur++;
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  vector<vector<pair<int, int>>> adj(n);
  day.resize(n - 1, -1);
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    adj[u].push_back({v, i});
    adj[v].push_back({u, i});
  }
  vector<bool> vis(n);
  dfs(0, adj, vis);
  map<int, vector<int>> m;
  for (int i = 0; i < day.size(); i++) {
    m[day[i]].push_back(i);
  }
  cout << m.size() << '\n';
  for (auto &d : m) {
    cout << d.second.size() << ' ';
    for (auto &x : d.second) cout << x + 1 << ' ';
    cout << '\n';
  }
}
