#include <bits/stdc++.h>
using namespace std;
long long n, mx = 0;
vector<long long> g[200001], used(200001), ans[200001];
map<pair<long long, long long>, long long> mp;
void dfs(long long v, long long p, long long pr) {
  long long cnt = 0, c = 0, o = 0, q = 0;
  used[v] = 1;
  for (auto k : g[v]) {
    cnt++;
    c++;
    if (used[k] == 0) {
      if (c == p) {
        if (o == 0) {
          q = 1;
          c++;
          o = c;
        }
        dfs(k, o, v);
        ans[o].push_back(mp[{v, k}]);
      } else {
        dfs(k, c, v);
        ans[c].push_back(mp[{v, k}]);
      }
    } else if (pr == k && q == 1) {
      c--;
    } else
      o = c;
  }
  mx = max(mx, cnt);
}
int main() {
  cin >> n;
  for (long long i = 1; i < n; i++) {
    long long a, b;
    cin >> a >> b;
    g[a].push_back(b);
    g[b].push_back(a);
    mp[{a, b}] = i;
    mp[{b, a}] = i;
  }
  for (long long i = 1; i <= n; i++) {
    sort(g[i].begin(), g[i].end());
  }
  dfs(1, -1, -1);
  cout << mx << endl;
  for (long long i = 1; i <= mx; i++) {
    cout << ans[i].size() << " ";
    for (long long j = 0; j < ans[i].size(); j++) cout << ans[i][j] << " ";
    cout << endl;
  }
  return 0;
}
