#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
int n, rs = 0;
vector<pair<int, int> > adj[200005];
vector<int> ans[200005];
void dfs(int nw, int pr, int dy) {
  int cnt = 0;
  for (auto i : adj[nw]) {
    int nx = i.first, nm = i.second;
    if (nx == pr) continue;
    cnt++;
    if (cnt == dy) cnt++;
    ans[cnt].push_back(nm);
    rs = max(rs, cnt);
    dfs(nx, nw, cnt);
  }
}
int main() {
  cin >> n;
  for (int u, v, i = 1; i < n; i++) {
    cin >> u >> v;
    adj[u].push_back({v, i});
    adj[v].push_back({u, i});
  }
  dfs(1, 0, 0);
  cout << rs << endl;
  for (int i = 1; i <= rs; i++) {
    cout << ans[i].size() << " ";
    for (int j : ans[i]) cout << j << " ";
    cout << endl;
  }
  return 0;
}
