#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > gr[200005];
vector<int> ans[200005];
int mx;
void dfs(int v, int pr, int day) {
  int cd = 0;
  for (auto &i : gr[v]) {
    if (i.first == pr) continue;
    while (++cd == day)
      ;
    mx = max(mx, cd);
    ans[cd].push_back(i.second);
    dfs(i.first, v, cd);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    gr[a].push_back({b, i + 1});
    gr[b].push_back({a, i + 1});
  }
  dfs(1, -1, 0);
  cout << mx;
  for (int i = 1; i <= mx; i++) {
    cout << '\n' << ans[i].size();
    for (auto j : ans[i]) {
      cout << ' ' << j;
    }
  }
}
