#include <bits/stdc++.h>
using namespace std;
const int MX = 2e5 + 7;
int n;
vector<pair<int, int> > g[MX];
int id[MX];
vector<int> ans[MX];
int c[MX];
int sz;
void solve(int v, int p = -1) {
  int d = 1;
  for (auto u : g[v]) {
    if (u.first == p) {
      continue;
    }
    while (c[v] == d) {
      d++;
    }
    c[u.first] = d;
    ans[d].push_back(u.second);
    sz = max(sz, d);
    d++;
    solve(u.first, v);
  }
}
int main() {
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    g[x].push_back(make_pair(y, i));
    g[y].push_back(make_pair(x, i));
  }
  solve(1);
  cout << sz << endl;
  for (int i = 1; i <= sz; i++) {
    cout << ans[i].size() << " ";
    for (int j = 0; j < ans[i].size(); j++) {
      cout << ans[i][j] + 1 << " ";
    }
    cout << endl;
  }
}
