#include <bits/stdc++.h>
using namespace std;
const int mn = 200010;
int n, k;
vector<int> ans[mn];
vector<pair<int, int> > e[mn];
int clr[mn];
void dfs(int v, int p, int cl) {
  int q = 1;
  for (int i = 0; i < e[v].size(); i++) {
    if (e[v][i].first == p) {
      continue;
    }
    if (q == cl) {
      q++;
    }
    clr[e[v][i].second] = q;
    dfs(e[v][i].first, v, q);
    q++;
  }
}
int main() {
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    e[x].push_back(make_pair(y, i));
    e[y].push_back(make_pair(x, i));
  }
  k = 0;
  for (int i = 0; i < n; i++) {
    if (e[i].size() > e[k].size()) {
      k = i;
    }
  }
  cout << e[k].size() << "\n";
  dfs(k, k, 0);
  for (int i = 0; i < n - 1; i++) {
    ans[clr[i]].push_back(i + 1);
  }
  for (int i = 1; i <= e[k].size(); i++) {
    cout << ans[i].size() << " ";
    for (int j = 0; j < ans[i].size(); j++) {
      cout << ans[i][j] << " ";
    }
    cout << "\n";
  }
  return 0;
}
