#include <bits/stdc++.h>
using namespace std;
struct edge {
  int to, next, id;
} e[200010 << 1];
int box[200010], cnt;
void init() {
  memset(box, -1, sizeof(box));
  cnt = 0;
}
int ma;
void add(int from, int to, int id) {
  e[cnt].id = id;
  e[cnt].to = to;
  e[cnt].next = box[from];
  box[from] = cnt++;
}
vector<int> vec[200010];
void dfs(int now, int fa, int pre) {
  ma = max(ma, pre);
  int num = 1;
  for (int t = box[now]; t + 1; t = e[t].next) {
    int v = e[t].to;
    if (v != fa) {
      if (num == pre) num++;
      vec[num].push_back(e[t].id);
      dfs(v, now, num++);
    }
  }
}
int main() {
  int n;
  scanf("%d", &n);
  init();
  for (int i = 1; i < n; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    add(u, v, i);
    add(v, u, i);
  }
  dfs(1, 0, 0);
  printf("%d\n", ma);
  for (int i = 1; i <= ma; i++) {
    int len = vec[i].size();
    printf("%d ", len);
    for (int j = 0; j < len; j++) {
      printf("%d ", vec[i][j]);
    }
    printf("\n");
  }
  return 0;
}
