#include <bits/stdc++.h>
using namespace std;
long long n, a;
const long long MAXN = 200000;
vector<pair<long long, long long> > graph[MAXN];
vector<long long> times[MAXN];
long long maxD = 0;
void dfs(long long v, long long p, long long t) {
  long long timer = 0;
  long long deg = (p == -1 ? 0 : 1);
  for (long long i = 0; i < graph[v].size(); i++) {
    if (timer == t) {
      timer++;
    }
    if (graph[v][i].first == p) {
      continue;
    }
    times[timer].push_back(graph[v][i].second);
    dfs(graph[v][i].first, v, timer);
    timer++;
    deg++;
  }
  maxD = max(maxD, deg);
}
int main() {
  cin >> n;
  for (long long i = 0; i < n - 1; i++) {
    long long v, u;
    cin >> v >> u;
    v--, u--;
    graph[v].push_back({u, i});
    graph[u].push_back({v, i});
  }
  dfs(0, -1, -1);
  cout << maxD << "\n";
  for (long long i = 0; i < maxD; i++) {
    cout << times[i].size() << " ";
    for (auto t : times[i]) {
      cout << t + 1 << " ";
    }
    cout << "\n";
  }
  return 0;
}
