#include <bits/stdc++.h>
using namespace std;
vector<int> mpp[200010];
map<pair<int, int>, int> finde;
map<int, vector<int>> ans;
int vis[200010];
void dfs(int u, int color) {
  int cnt = 1;
  vis[u] = 1;
  for (auto v : mpp[u])
    if (!vis[v]) {
      if (cnt == color) cnt++;
      ans[cnt].push_back(finde[{u, v}]);
      dfs(v, cnt);
      cnt++;
    }
}
int main() {
  ios::sync_with_stdio(false);
  cout.setf(ios::fixed);
  cout.precision(20);
  int n;
  scanf("%d", &n);
  for (int i = (1); i <= (n - 1); ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    mpp[x].push_back(y);
    mpp[y].push_back(x);
    finde[{x, y}] = i;
    finde[{y, x}] = i;
  }
  dfs(1, 0);
  printf("%d\n", (int)ans.size());
  for (auto v : ans) {
    printf("%d ", (int)v.second.size());
    for (int i = (0); i <= (v.second.size() - 1); ++i)
      printf("%d%c", v.second[i], i == v.second.size() - 1 ? '\n' : ' ');
  }
  return 0;
}
