#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 100;
struct Edge {
  int v, nxt;
  int id;
  Edge() {}
  Edge(int vv, int next) {
    v = vv;
    nxt = next;
  }
} edge[N << 1];
int idx;
int head[N];
void addEdge(int u, int v, int id) {
  edge[++idx] = Edge(v, head[u]);
  edge[idx].id = id;
  head[u] = idx;
}
vector<int> ret[N];
int mx = 0;
void dfs(int u, int f, int fob) {
  int cnt = 1;
  for (int k = head[u]; k; k = edge[k].nxt) {
    int v = edge[k].v;
    if (v == f) continue;
    int id = edge[k].id;
    while (cnt == fob) cnt++;
    mx = max(mx, cnt);
    dfs(v, u, cnt);
    ret[cnt++].push_back(id);
  }
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    addEdge(u, v, i);
    addEdge(v, u, i);
  }
  dfs(1, -1, 0);
  printf("%d\n", mx);
  for (int i = 1; i <= mx; i++) {
    printf("%d", ret[i].size());
    for (int j = 0; j < ret[i].size(); j++) printf(" %d", ret[i][j]);
    puts("");
  }
  return 0;
}
