#include <bits/stdc++.h>
using namespace std;
class graphal {
 public:
  int n, mx = 0;
  vector<pair<int, int> > *ed;
  vector<int> *ans;
  graphal(int n) {
    this->n = n;
    ed = new vector<pair<int, int> >[n];
    ans = new vector<int>[n + 1]();
  }
  ~graphal() {
    delete[] ed;
    delete[] ans;
  }
  void add(int a, int b, int ix) {
    ed[a].push_back(pair<int, int>(b, ix));
    ed[b].push_back(pair<int, int>(a, ix));
  }
  void dfs(int ix, int du, int pix) {
    int dtu = 0;
    mx = max(mx, (int)ed[ix].size());
    for (auto i : ed[ix])
      if (i.first != pix) {
        if (dtu == du) dtu++;
        ans[dtu].push_back(i.second);
        dfs(i.first, dtu, ix);
        dtu++;
      }
  }
  void doit() {
    dfs(0, -1, -1);
    printf("%d\n", mx);
    for (int i = 0; i < mx; i++) {
      printf("%lu ", ans[i].size());
      for (auto j : ans[i]) printf("%d ", j);
      printf("\n");
    }
  }
};
int main() {
  int n, a, b;
  scanf("%d", &n);
  graphal g(n);
  for (auto i = 0; i < n - 1; i++) {
    scanf("%d %d", &a, &b);
    a--, b--;
    g.add(a, b, i + 1);
  }
  g.doit();
  return 0;
}
