#include <bits/stdc++.h>
using namespace std;
int l[200005], r[200005], sz;
vector<int> g[200005], arr[200005];
void dfs(int v, int pr, int wt) {
  int cnt = 0;
  for (int i = 0, id, to; i < g[v].size(); ++i) {
    id = g[v][i];
    if (v == l[id]) {
      to = r[id];
    } else {
      to = l[id];
    }
    if (to == pr) {
      continue;
    }
    if (++cnt == wt) {
      ++cnt;
    }
    arr[cnt].push_back(id);
    dfs(to, v, cnt);
  }
  if (cnt > sz) {
    sz = cnt;
  }
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i < n; ++i) {
    scanf("%d %d", &l[i], &r[i]);
    g[l[i]].push_back(i);
    g[r[i]].push_back(i);
  }
  dfs(1, -1, -1);
  printf("%d\n", sz);
  for (int i = 1; i <= sz; ++i) {
    printf("%d ", arr[i].size());
    for (int j = 0; j < arr[i].size(); ++j) {
      printf("%d ", arr[i][j]);
    }
    printf("\n");
  }
  return 0;
}
