#include <bits/stdc++.h>
using namespace std;
const int maxn = 200000;
int n, x;
bool was[maxn];
vector<pair<int, int> > g[maxn];
vector<int> ans[maxn];
void dfs(int u, int c) {
  was[u] = true;
  int cur_c = 0;
  for (int i = 0; i < int(g[u].size()); i++) {
    int v = g[u][i].first;
    int id = g[u][i].second;
    if (was[v]) continue;
    if (cur_c == c) {
      cur_c++;
    }
    ans[cur_c].push_back(id);
    dfs(v, cur_c);
    cur_c++;
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    u--;
    v--;
    g[u].push_back(make_pair(v, i));
    g[v].push_back(make_pair(u, i));
  }
  x = 0;
  int x_id = -1;
  for (int i = 0; i < n; i++) {
    was[i] = false;
    if (int(g[i].size()) > x) {
      x = g[i].size();
      x_id = i;
    }
  }
  dfs(x_id, -1);
  printf("%d\n", x);
  for (int i = 0; i < x; i++) {
    printf("%d", int(ans[i].size()));
    for (int j = 0; j < int(ans[i].size()); j++) {
      printf(" %d", ans[i][j] + 1);
    }
    printf("\n");
  }
  return 0;
}
