#include <bits/stdc++.h>
using namespace std;
const long long MAX = 1e18;
const long long MOD = 1e9 + 7;
const double eps = 1e-8;
long long t, m, n, k;
vector<pair<int, int>> a[200005];
set<int> st;
vector<pair<pair<int, int>, int>> p1, p2;
vector<int> ans[200005];
void dfs(int u, int p, int color) {
  int last = 0;
  for (auto i : a[u]) {
    int v = i.first, w = i.second;
    if (v == p) continue;
    if (last == color) last++;
    ans[last].push_back(w);
    dfs(v, u, last);
    last++;
  }
}
int main() {
  cin >> n;
  for (int i = 1; i <= n - 1; i++) {
    int u, v;
    cin >> u >> v;
    a[u].push_back({v, i});
    a[v].push_back({u, i});
  }
  dfs(1, -1, -1);
  long long cnt = 0;
  for (cnt = 0; ans[cnt].size(); cnt++)
    ;
  cout << cnt << endl;
  for (int i = 0; i < cnt; i++) {
    cout << ans[i].size() << ' ';
    for (auto j : ans[i]) cout << j << ' ';
    cout << endl;
  }
}
