#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > ed[(int)(200005)];
vector<int> ans[(int)(200005)];
int n, cvp;
void dfs(int cur, int back, int back_ed) {
  int top = 0;
  for (auto i : ed[cur]) {
    if (i.first == back) continue;
    top++;
    if (top == back_ed) top++;
    cvp = max(cvp, top);
    ans[top].push_back(i.second);
    dfs(i.first, cur, top);
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    ed[u].push_back(make_pair(v, i));
    ed[v].push_back(make_pair(u, i));
  }
  dfs(1, -1, -1);
  printf("%d\n", cvp);
  for (int i = 1; i <= cvp; i++) {
    printf("%d ", (int)ans[i].size());
    for (auto j : ans[i]) printf("%d ", j);
    printf("\n");
  }
}
