#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200000;
int n, degree[MAXN];
vector<pair<int, int> > edges[MAXN];
vector<vector<int> > answers;
void dfs(int u, int parent, int day) {
  int dayIdx = 0;
  for (auto &edge : edges[u])
    if (edge.first != parent) {
      dayIdx += dayIdx == day;
      if (dayIdx >= ((int)(answers).size())) answers.push_back(vector<int>());
      answers[dayIdx].push_back(edge.second);
      dfs(edge.first, u, dayIdx++);
    }
}
int main() {
  scanf("%d", &n);
  for (int i = (1); i < (n); ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    x--;
    y--;
    edges[x].push_back(make_pair(y, i));
    edges[y].push_back(make_pair(x, i));
    degree[x]++;
    degree[y]++;
  }
  dfs(0, -1, -1);
  printf("%d\n", ((int)(answers).size()));
  for (auto &answer : answers) {
    printf("%d", ((int)(answer).size()));
    for (auto &x : answer) printf(" %d", x);
    putchar('\n');
  }
  return 0;
}
