#include <bits/stdc++.h>
using namespace std;
const int M = 200001;
struct Edge {
  int u, v;
  int ot(int x) { return u ^ x ^ v; }
} e[M];
vector<vector<int>> adj;
bool done[M];
int deg[M];
int num[M];
const int N = 200001;
vector<int> sol[N];
void dfs(int u, int p = -1, int n = -1) {
  int cur = 1;
  for (auto el : adj[u]) {
    if (e[el].ot(u) == p) continue;
    if (cur == n) cur++;
    num[el] = cur;
    dfs(e[el].ot(u), u, cur);
    cur++;
  }
}
int main() {
  int n;
  cin >> n;
  adj.resize(n);
  for (int i = 0; i < n - 1; i++) {
    scanf("%d %d", &e[i].u, &e[i].v);
    e[i].u--;
    e[i].v--;
    adj[e[i].u].push_back(i);
    adj[e[i].v].push_back(i);
    deg[e[i].u]++;
    deg[e[i].v]++;
  }
  int mxn, mx;
  mx = -1;
  for (int i = 0; i < n; i++)
    if (deg[i] > mx) mx = deg[i], mxn = i;
  dfs(mxn);
  for (int i = 0; i < n - 1; i++) sol[num[i]].push_back(i + 1);
  cout << mx << endl;
  for (int i = 1; i <= mx; i++) {
    printf("%d", sol[i].size());
    for (auto el : sol[i]) printf(" %d", el);
    puts("");
  }
}
