#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > g;
map<pair<int, int>, int> MAP;
map<int, vector<int> > colors;
int mx;
void dfs(int v, int c, int p = -1) {
  int cur(0);
  for (int i(0), _l((int)(((int)g[v].size())) - 1); i <= _l; ++i) {
    int to(g[v][i]);
    if (to == p) continue;
    int k(MAP[make_pair(v, to)]);
    if (cur == c) ++cur;
    colors[cur].push_back(k);
    dfs(to, cur, v);
    ++cur;
  }
}
void solve() {
  int n;
  scanf("%d", &n);
  g.resize(n);
  for (int i(0), _l((int)(n - 1) - 1); i <= _l; ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    --a, --b;
    g[a].push_back(b);
    g[b].push_back(a);
    MAP[make_pair(a, b)] = MAP[make_pair(b, a)] = i;
  }
  dfs(0, -1);
  printf("%d\n", ((int)colors.size()));
  for (auto &kv : colors) {
    vector<int> &d(kv.second);
    printf("%d", ((int)d.size()));
    for (int i(0), _l((int)(((int)d.size())) - 1); i <= _l; ++i)
      printf(" %d", d[i] + 1);
    printf("\n");
  }
}
int main() {
  solve();
  return 0;
}
