#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:67108864")
using namespace std;
int n;
vector<int> vc[222222];
vector<int> cn[222222];
set<int, less<int> > vv[222222];
int dr[222222][2];
bool color[222222];
int mx = 0;
void dfs(int v) {
  color[v] = true;
  for (size_t i = 0; i < cn[v].size(); i++) {
    int j = cn[v][i];
    int k = 0;
    if (dr[j][0] == v) {
      k = dr[j][1];
    } else {
      k = dr[j][0];
    }
    if (!color[k]) {
      int l = *(vv[v].begin());
      vv[v].erase(vv[v].begin());
      if (l > mx) mx = l;
      set<int, less<int> >::iterator ii = vv[k].find(l);
      if (ii != vv[k].end()) vv[k].erase(ii);
      vc[l].push_back(j);
      dfs(k);
    }
  }
}
int main() {
  scanf("%i", &n);
  memset(color, 0, sizeof(color));
  for (int i = 0; i < n - 1; i++) {
    scanf("%i%i", &dr[i][0], &dr[i][1]);
    dr[i][0]--;
    dr[i][1]--;
    vv[dr[i][0]].insert(vv[dr[i][0]].size());
    vv[dr[i][1]].insert(vv[dr[i][1]].size());
    cn[dr[i][0]].push_back(i);
    cn[dr[i][1]].push_back(i);
  }
  dfs(0);
  printf("%i\n", mx + 1);
  for (int i = 0; i <= mx; i++) {
    printf("%i ", vc[i].size());
    for (int j = 0; j < vc[i].size(); j++) {
      printf("%i ", vc[i][j] + 1);
    }
    printf("\n");
  }
}
