#include <bits/stdc++.h>
const int N = 1000001;
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  vector<pair<int, int>> a[n + 1];
  int ans = 0;
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    a[u].push_back(make_pair(v, i + 1));
    a[v].push_back(make_pair(u, i + 1));
    ans = max({ans, (int)a[u].size(), (int)a[v].size()});
  }
  cout << ans << '\n';
  int final[n], vis[n + 1];
  memset(final, -1, sizeof final);
  memset(vis, 0, sizeof vis);
  queue<int> q;
  q.push(1);
  vis[1] = 1;
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    map<int, int> d;
    for (auto [v, ind] : a[u]) {
      d[final[ind]] = 1;
    }
    int day = 1;
    for (auto [v, ind] : a[u]) {
      if (final[ind] == -1) {
        while (d[day]) {
          ++day;
        }
        final[ind] = day++;
      }
      if (vis[v] == 0) {
        vis[v] = 1;
        q.push(v);
      }
    }
  }
  vector<int> f1[ans + 1];
  for (int i = 1; i < n; i++) {
    f1[final[i]].push_back(i);
  }
  for (int i = 1; i < ans + 1; i++) {
    cout << f1[i].size() << ' ';
    for (int e : f1[i]) {
      cout << e << ' ';
    }
    cout << '\n';
  }
}
