#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > g(2e5 + 10), d;
map<pair<int, int>, int> mp;
queue<pair<int, int> > q;
int main() {
  ios_base::sync_with_stdio();
  int n;
  cin >> n;
  int ans = 0;
  for (int i = 0; i < n - 1; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    g[x].push_back(y);
    g[y].push_back(x);
    ans = max(max(int(g[x].size()), int(g[y].size())), ans);
    if (x > y) swap(x, y);
    pair<int, int> z;
    z.first = x;
    z.second = y;
    mp[z] = i + 1;
  }
  cout << ans << endl;
  d.resize(ans + 1);
  q.push(make_pair(1, 0));
  vector<bool> used(n + 1);
  while (!q.empty()) {
    int v = q.front().first;
    int val = q.front().second;
    used[v] = true;
    q.pop();
    int z = 1;
    for (int i = 0; i < g[v].size(); ++i) {
      if (used[g[v][i]]) continue;
      if (z == val) z++;
      int x = g[v][i];
      int y = v;
      if (x > y) swap(x, y);
      pair<int, int> pr;
      pr.first = x;
      pr.second = y;
      d[z].push_back(mp[pr]);
      q.push(make_pair(g[v][i], z));
      z++;
    }
  }
  for (int i = 1; i <= ans; i++) {
    printf("%d ", d[i].size());
    for (int j = 0; j < d[i].size(); j++) printf("%d ", d[i][j]);
    printf("\n");
  }
  return 0;
}
