#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > G[200100];
vector<int> rs[200100];
void dfs(int x, int y, int p) {
  int pos = 0;
  int n = G[x].size();
  for (int i = 0; i < n; ++i) {
    int to = G[x][i].first;
    if (to == y) continue;
    if (pos == p) pos++;
    rs[pos].push_back(G[x][i].second);
    dfs(to, x, pos);
    pos++;
  }
}
int main() {
  int N, x, y;
  scanf("%d", &N);
  for (int i = 1; i < N; ++i) {
    scanf("%d %d", &x, &y);
    G[x].push_back({y, i});
    G[y].push_back({x, i});
  }
  dfs(1, -1, -1);
  x = 0;
  for (int i = 1; i <= N; ++i) {
    x = ((x) > (G[i].size()) ? (x) : (G[i].size()));
  }
  printf("%d\n", x);
  for (int i = 0; i < x; ++i) {
    y = rs[i].size();
    printf("%d ", y);
    for (int j = 0; j < y; ++j) printf("%d ", rs[i][j]);
    printf("\n");
  }
  return 0;
}
