#include <bits/stdc++.h>
using namespace std;
const int N = 200000 + 1000;
vector<pair<int, int> > g[N];
vector<int> ans[N];
int n, sum, tot, u, v;
void dfs(int x, int fa, int son_t) {
  int l = g[x].size();
  int sum = 0;
  for (int i = 0; i < l; i++) {
    int v = g[x][i].first;
    if (v == fa) continue;
    sum++;
    if (sum == son_t) sum++;
    ans[sum].push_back(g[x][i].second);
    tot = (sum > tot ? sum : tot);
    dfs(v, x, sum);
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < N; i++) {
    g[i].clear();
    ans[i].clear();
  }
  for (int i = 1; i <= n - 1; i++) {
    scanf("%d%d", &u, &v);
    g[u].push_back(make_pair(v, i));
    g[v].push_back(make_pair(u, i));
  }
  sum = tot = 0;
  dfs(1, -1, 0);
  printf("%d\n", tot);
  for (int i = 1; i <= tot; i++) {
    int l = ans[i].size();
    printf("%d", l);
    for (int j = 0; j < l; j++) printf(" %d", ans[i][j]);
    printf("\n");
  }
  return 0;
}
