#include <bits/stdc++.h>
using namespace std;
const int MN = 200005;
map<pair<int, int>, int> num;
vector<int> G[MN], wyn[MN];
int dp[MN], used[MN];
int res;
void dfs(int x) {
  int c = 0;
  used[x] = 1;
  int s = G[x].size();
  for (int i = 0; i < s; ++i) {
    if (!used[G[x][i]]) {
      ++c;
      if (c == dp[x]) ++c;
      dp[G[x][i]] = c;
      res = max(res, dp[G[x][i]]);
      wyn[c].push_back(num[make_pair(min(x, G[x][i]), max(x, G[x][i]))]);
      dfs(G[x][i]);
    }
  }
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i < n; ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    num[make_pair(min(a, b), max(a, b))] = i;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  dfs(1);
  printf("%d\n", res);
  for (int i = 1; i <= res; ++i) {
    int si = wyn[i].size();
    printf("%d ", si);
    for (int j = 0; j < si; ++j) printf("%d ", wyn[i][j]);
    printf("\n");
  }
}
