#include <bits/stdc++.h>
using namespace std;
unordered_map<int, vector<pair<int, int> > > ans;
vector<bool> used;
void rec(vector<vector<int> > &v, int pos, int color) {
  int act_color = 0;
  for (int act : v[pos])
    if (!used[act]) {
      act_color += (act_color == color);
      used[act] = true;
      ans[act_color].push_back(make_pair(pos, act));
      rec(v, act, act_color);
      act_color++;
    }
}
long long pos(long long i, int j) { return (i * 1000000 + j); }
int main() {
  int n;
  cin >> n;
  vector<vector<int> > v(n);
  used.resize(n);
  unordered_map<long long, int> m;
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    a--;
    b--;
    v[a].push_back(b);
    v[b].push_back(a);
    m[pos(min(a, b), max(a, b))] = i + 1;
  }
  used[0] = true;
  rec(v, 0, -1);
  cout << ans.size() << endl;
  for (auto el : ans) {
    cout << el.second.size() << ' ';
    for (auto fuck : el.second)
      printf(
          "%d ",
          m[pos(min(fuck.first, fuck.second), max(fuck.first, fuck.second))]);
    cout << endl;
  }
  return 0;
}
