#include <bits/stdc++.h>
using namespace std;
int n;
const int maxn = 2e5 + 10;
struct node {
  int next, v, num;
} e[maxn * 2];
int tot, head[maxn];
vector<int> ans[maxn];
int du[maxn];
void add(int x, int y, int num) {
  e[++tot].v = y;
  e[tot].next = head[x];
  e[tot].num = num;
  head[x] = tot;
}
void dfs(int u, int fa, int last) {
  int j = 1;
  for (int i = head[u]; i; i = e[i].next) {
    int to = e[i].v;
    if (to == fa) continue;
    if (j == last) ++j;
    ans[j].push_back(e[i].num);
    dfs(to, u, j);
    j++;
  }
}
int main() {
  cin >> n;
  for (int i = 1; i < n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    add(x, y, i);
    add(y, x, i);
    du[x]++;
    du[y]++;
  }
  int cnt = 0;
  for (int i = 1; i <= n; i++) cnt = max(cnt, du[i]);
  dfs(1, 0, 0);
  cout << cnt << endl;
  for (int i = 1; i <= cnt; i++) {
    cout << ans[i].size() << " ";
    for (int j = 0; j < ans[i].size(); j++) {
      cout << ans[i][j] << " ";
    }
    cout << endl;
  }
}
