#include <bits/stdc++.h>
using namespace std;
long long n;
vector<pair<long long, long long> > g[200005];
long long sz;
vector<long long> ans[200005];
void dfs(long long s, long long pr, long long tt) {
  long long cur = 0;
  for (auto i : g[s]) {
    if (i.first == pr) continue;
    cur++;
    if (cur == tt) cur += 1;
    sz = max(sz, cur);
    ans[cur].push_back(i.second);
    dfs(i.first, s, cur);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  for (long long i = 1; i < n; i++) {
    long long a, b;
    cin >> a >> b;
    g[a].push_back(make_pair(b, i));
    g[b].push_back(make_pair(a, i));
  }
  dfs(1, -1, 0);
  cout << sz << "\n";
  for (long long i = 1; i <= sz; i++) {
    cout << ans[i].size();
    for (auto j : ans[i]) cout << " " << j;
    cout << "\n";
  }
  return 0;
}
