#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > a, b, ans;
int i, j, n, mx;
int x, y, used[200005];
void paint(int v, int parent_color) {
  used[v] = 1;
  int cur_color = 0;
  for (int i = 0; i < a[v].size(); i++) {
    if (!used[a[v][i]]) {
      if (cur_color == parent_color) cur_color++;
      ans[cur_color].push_back(b[v][i]);
      if (cur_color > mx) mx = cur_color;
      paint(a[v][i], cur_color);
      cur_color++;
    }
  }
}
int main() {
  scanf("%d", &n);
  a.resize(n + 1);
  b.resize(n + 1);
  ans.resize(n);
  for (i = 0; i < n - 1; i++) {
    scanf("%d%d", &x, &y);
    a[x].push_back(y);
    a[y].push_back(x);
    b[x].push_back(i + 1);
    b[y].push_back(i + 1);
  }
  paint(1, -1);
  printf("%d\n", mx + 1);
  for (i = 0; i <= mx; i++) {
    printf("%d ", ans[i].size());
    for (j = 0; j < ans[i].size(); j++) printf("%d ", ans[i][j]);
    printf("\n");
  }
  return 0;
}
