#include <bits/stdc++.h>
using namespace std;
const int Max = 2e5;
vector<pair<int, int> > G[Max + 5];
vector<int> ans[Max + 5];
int n;
int sum;
void dfs(int x, int fa, int t) {
  int k = 0;
  for (int i = 0; i < G[x].size(); i++) {
    if (G[x][i].first == fa) continue;
    k++;
    if (k == t) k++;
    dfs(G[x][i].first, x, k);
    ans[k].push_back(G[x][i].second);
    sum = max(sum, k);
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    G[x].push_back(make_pair(y, i));
    G[y].push_back(make_pair(x, i));
  }
  dfs(1, 0, 0);
  printf("%d\n", sum);
  for (int i = 1; i <= sum; i++) {
    printf("%d ", ans[i].size());
    for (int j = 0; j < ans[i].size(); j++) {
      printf("%d ", ans[i][j]);
    }
    printf("\n");
  }
  return 0;
}
