#include <bits/stdc++.h>
using namespace std;
int n, i, j, a, b, mx, gag, son, parent[200005], mark[200005];
vector<pair<int, int> > g[200005];
vector<int> q[200005];
void build(int v) {
  for (int i = 0; i < g[v].size(); i++) {
    int to = g[v][i].first;
    if (to == parent[v]) continue;
    parent[to] = v;
    build(to);
  }
}
void dfs(int v) {
  int z = 1;
  for (int i = 0; i < g[v].size(); i++) {
    int to = g[v][i].first;
    if (to == parent[v]) continue;
    if (z == mark[v]) z++;
    q[z].push_back(g[v][i].second);
    mark[to] = z;
    z++;
    dfs(to);
  }
}
int main() {
  scanf("%d", &n);
  for (i = 1; i < n; i++) {
    scanf("%d%d", &a, &b);
    g[a].push_back(make_pair(b, i));
    g[b].push_back(make_pair(a, i));
  }
  for (i = 1; i <= n; i++) {
    if (g[i].size() > mx) {
      mx = g[i].size();
      gag = i;
    }
  }
  build(gag);
  mark[gag] = -1;
  dfs(gag);
  printf("%d\n", mx);
  for (i = 1; i <= mx; i++) {
    printf("%d ", q[i].size());
    for (j = 0; j < q[i].size(); j++) printf("%d ", q[i][j]);
    printf("\n");
  }
  return 0;
}
