#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
  return b ? gcd(b, a % b) : a;
}
long long int lcm(long long int a, long long int b) {
  return a * b / gcd(a, b);
}
const int N = 2e5 + 10;
vector<pair<int, int>> ad[N];
vector<int> ans[N];
int n;
void dfs(int v, int lvl, int pa) {
  int cur_level = 0;
  for (auto ed : ad[v]) {
    int to, id;
    tie(to, id) = ed;
    if (to == pa) continue;
    if (cur_level == lvl) cur_level++;
    ans[cur_level].push_back(id);
    dfs(to, cur_level, v);
    cur_level++;
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    ad[x].push_back({y, i});
    ad[y].push_back({x, i});
  }
  dfs(1, 1e9, 0);
  int sz = N;
  while (ans[sz - 1].empty()) sz--;
  printf("%d\n", sz);
  for (int i = 0; i < sz; i++) {
    printf("%d", (int)ans[i].size());
    for (auto u : ans[i]) printf(" %d", u);
    puts("");
  }
  return 0;
}
