#include <bits/stdc++.h>
using namespace std;
int x;
vector<int> g[200010];
map<pair<int, int>, int> ans;
map<pair<int, int>, int> pos;
bool cmp(int x, int y) {
  if (g[x] >= g[y]) return false;
  return true;
}
vector<vector<int> > res;
bool u[200010];
int main() {
  cin >> x;
  for (int i = 0; i < x - 1; i++) {
    int l, r;
    cin >> l >> r;
    l--;
    r--;
    g[l].push_back(r);
    g[r].push_back(l);
    pos[{l, r}] = i + 1;
    pos[{r, l}] = i + 1;
  }
  int ind = 0;
  for (int i = 0; i < x; i++) {
    sort(g[i].begin(), g[i].end(), cmp);
    if (g[ind].size() < g[i].size()) ind = i;
  }
  queue<pair<int, int> > q;
  q.push({0, ind});
  int kek = 0;
  while (!q.empty()) {
    int now;
    int p;
    auto m = q.front();
    q.pop();
    now = m.second;
    p = m.first;
    if (!u[now]) {
      u[now] = true;
      int f = 1;
      for (int i = 0; i < g[now].size(); i++) {
        if (p == f) f++;
        if (!u[g[now][i]]) {
          ans[{now, g[now][i]}] = f;
          q.push({f, g[now][i]});
          f++;
        }
      }
      kek = max(kek, f);
    }
  }
  for (int i = 0; i < kek - 1; i++) res.push_back(vector<int>());
  for (auto i = ans.begin(); i != ans.end(); i++) {
    res[i->second - 1].push_back(pos[i->first]);
  }
  cout << res.size() << endl;
  for (int i = 0; i < res.size(); i++) {
    cout << res[i].size() << ' ';
    for (int j = 0; j < res[i].size(); j++) {
      cout << res[i][j] << ' ';
    }
    cout << endl;
  }
}
