#include <bits/stdc++.h>
long long mpow(long long a, long long n, long long mod) {
  long long ret = 1;
  long long b = a;
  while (n) {
    if (n & 1) ret = (ret * b) % mod;
    b = (b * b) % mod;
    n >>= 1;
  }
  return (long long)ret;
}
using namespace std;
vector<int> ans[(int)(5e5 + 500)];
vector<pair<int, int> > G[(int)(5e5 + 500)];
int fin = 0;
void dfs(int x, int p, int val) {
  int nval = 0;
  for (int i = 0; i < G[x].size(); i++) {
    int to = G[x][i].first;
    int id = G[x][i].second;
    if (to == p) continue;
    nval++;
    nval += (nval == val);
    fin = max(fin, nval);
    ans[nval].push_back(id);
    dfs(to, x, nval);
  }
}
void solve() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n - 1; i++) {
    int x, y;
    scanf("%d", &x);
    scanf("%d", &y);
    G[x].push_back(make_pair(y, i));
    G[y].push_back(make_pair(x, i));
  }
  dfs(1, 0, 0);
  printf("%d", fin);
  printf("\n");
  for (int i = 1; i <= fin; i++) {
    int sz = ans[i].size();
    printf("%d", sz);
    printf(" ");
    for (int j = 0; j < sz; j++) {
      printf("%d", ans[i][j]);
      printf(" ");
    }
    printf("\n");
  }
}
int main() {
  int t = 1;
  for (int i = 1; i <= t; i++) {
    solve();
  }
  return 0;
}
