#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200 * 1000 + 20;
bool mark[MAXN];
int n, x, y, g;
vector<pair<int, int>> gr[MAXN];
vector<int> ans[MAXN];
void dfs(int v, int u, int g) {
  int h = 1;
  for (pair<int, int> i : gr[v]) {
    if (i.first != u) {
      if (h == g) h++;
      ans[h].push_back(i.second);
      dfs(i.first, v, h);
      h++;
    }
  }
}
int main() {
  cin >> n;
  for (int i = 1; i <= n - 1; i++) {
    cin >> x >> y;
    gr[x].push_back({y, i});
    gr[y].push_back({x, i});
    g = max(g, max((int)gr[x].size(), (int)gr[y].size()));
  }
  cout << g << endl;
  dfs(1, 0, 0);
  for (int i = 1; i <= g; i++) {
    cout << ans[i].size() << " ";
    for (int j : ans[i]) cout << j << " ";
    cout << endl;
  }
  return 0;
}
