#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 7;
vector<pair<int, int> > e[MAXN];
vector<int> ans[MAXN];
void fixRoads(int u, int p, int c) {
  int i, edgeIndex, v, d = 0;
  for (auto it : e[u]) {
    v = it.first;
    edgeIndex = it.second;
    if (v != p) {
      if (d < c) {
        i = d;
      } else {
        i = d + 1;
      }
      ans[i].push_back(edgeIndex);
      fixRoads(v, u, i);
      d += 1;
    }
  }
}
int main() {
  int t, n, sz, i, j, u, v, c;
  cin >> n;
  for (i = 0; i < n - 1; i++) {
    cin >> u >> v;
    e[u].push_back({v, i + 1});
    e[v].push_back({u, i + 1});
  }
  c = MAXN;
  fixRoads(1, -1, c);
  sz = 0;
  for (i = 0; i < n; i++) {
    if (ans[i].size() >= 1) {
      sz += 1;
    } else if (ans[i].size() == 0) {
      break;
    }
  }
  cout << sz << endl;
  for (i = 0; i < sz; i++) {
    cout << ans[i].size() << " ";
    for (auto j : ans[i]) {
      cout << j << " ";
    }
    cout << endl;
  }
  return 0;
}
