#include <bits/stdc++.h>
using namespace std;
vector<int> ans[200005];
vector<pair<int, int> > g[200005];
int n, m, k, i, j, a[200005], b[200005], res;
set<int> st;
void dfs(int v, int p, int c) {
  int cur = 1;
  for (int j = 0; j < g[v].size(); j++)
    if (g[v][j].first != p) {
      if (cur == c) cur++;
      res = max(res, cur);
      ans[cur].push_back(g[v][j].second);
      dfs(g[v][j].first, v, cur);
      cur++;
    }
}
int main() {
  cin >> n;
  for (i = 1; i < n; i++) {
    cin >> a[i] >> b[i];
    g[a[i]].push_back(make_pair(b[i], i));
    g[b[i]].push_back(make_pair(a[i], i));
  }
  dfs(1, 0, 123123123);
  cout << res << endl;
  for (i = 1; i <= res; i++) {
    cout << ans[i].size() << " ";
    for (j = 0; j < ans[i].size(); j++) cout << ans[i][j] << " ";
    cout << endl;
  }
}
