#include <bits/stdc++.h>
using namespace std;
const int MAX = 200010;
vector<int> g[MAX];
vector<int> ans[MAX];
int rootId = 0;
int rootPow = 0;
map<pair<int, int>, int> m;
int bad[MAX];
bool used[MAX];
void dfs(int v, int parent) {
  if (used[v]) {
    return;
  }
  used[v] = true;
  int sz = (g[v].size());
  int p = bad[v];
  int time = 0;
  for (int i = 0; i < sz; i++) {
    if (g[v][i] == parent) {
      continue;
    }
    if (time == p) time++;
    int next = g[v][i];
    int id = m[make_pair(v, next)];
    ans[time].push_back(id);
    bad[next] = time;
    dfs(g[v][i], v);
    time++;
  }
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n - 1; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    x--;
    y--;
    g[x].push_back(y);
    g[y].push_back(x);
    m[make_pair(x, y)] = i;
    m[make_pair(y, x)] = i;
    if (g[x].size() > rootPow) {
      rootPow = g[x].size();
      rootId = x;
    }
    if (g[y].size() > rootPow) {
      rootPow = g[y].size();
      rootId = y;
    }
  }
  bad[rootId] = -1;
  dfs(rootId, -1);
  printf("%d\n", rootPow);
  for (int i = 0; i < n; i++) {
    if (ans[i].size() > 0) {
      printf("%d", ans[i].size());
      int sz = ans[i].size();
      for (int j = 0; j < sz; j++) {
        printf(" %d", ans[i][j] + 1);
      }
      printf("\n");
    }
  }
  return 0;
}
