#include <bits/stdc++.h>
using namespace std;
const int maxn = 5e5 + 10;
int f[maxn], color[maxn];
vector<pair<int, int> > g[maxn];
vector<int> vmark[maxn];
int n;
void input() {
  int z = 1;
  cin >> n;
  for (int i = 1; i < n; i++) {
    int x, y;
    cin >> x >> y;
    g[x].push_back(make_pair(y, z));
    g[y].push_back(make_pair(x, z));
    z++;
  }
}
void dfs(int v = 1, int p = 0) {
  int mx = 1;
  f[v] = p;
  for (int i = 0; i < g[v].size(); i++)
    if (g[v][i].first != p) {
      if (mx == color[v]) mx++;
      color[g[v][i].first] = mx;
      vmark[mx].push_back(g[v][i].second);
      mx++;
      dfs(g[v][i].first, v);
    }
}
int main() {
  int mx = 0;
  input();
  dfs();
  for (int i = 1; i < maxn; i++) {
    if (vmark[i].size() == 0) break;
    mx++;
  }
  cout << mx << endl;
  for (int i = 1; i < maxn; i++) {
    if (vmark[i].size() == 0) break;
    cout << vmark[i].size() << " ";
    for (int j = 0; j < vmark[i].size(); j++) cout << vmark[i][j] << " ";
    cout << endl;
  }
}
