#include <bits/stdc++.h>
using namespace std;
const int maxn = 200010;
vector<pair<int, int> > G[maxn];
vector<int> res[maxn];
int cnt = 0;
void dfs(int v, int p, int x) {
  int vl = 1;
  if (vl == x) {
    ++vl;
  }
  for (int i = 0; i < (int)G[v].size(); ++i) {
    int u = G[v][i].first;
    if (u != p) {
      res[vl].push_back(G[v][i].second);
      dfs(u, v, vl);
      ++vl;
      if (vl == x) {
        ++vl;
      }
    }
  }
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n - 1; ++i) {
    int u, v, id;
    scanf("%d%d", &u, &v);
    --u;
    --v;
    id = i + 1;
    G[u].push_back(make_pair(v, id));
    G[v].push_back(make_pair(u, id));
    cnt = max(cnt, (int)max(G[v].size(), G[u].size()));
  }
  dfs(0, 0, 0);
  printf("%d\n", cnt);
  for (int i = 1; i <= cnt; ++i) {
    printf("%d ", res[i].size());
    for (int j = 0; j < (int)res[i].size(); ++j) {
      printf("%d ", res[i][j]);
    }
    printf("\n");
  }
  return 0;
}
