#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
int dp[N];
int n, a, b;
vector<pair<int, int> > g[N];
vector<int> ans[N];
void dfs(int v, int p = -1, int d = -1) {
  int cnt = 0;
  for (int(i) = (0); i < (g[v].size()); ++(i)) {
    int to = g[v][i].first;
    if (to == p) continue;
    if (cnt == d) ++cnt;
    ans[cnt].push_back(g[v][i].second);
    dfs(to, v, cnt++);
  }
}
int main() {
  cin >> n;
  for (int(i) = (1); i < (n); ++(i)) {
    cin >> a >> b;
    --a;
    --b;
    g[a].push_back({b, i});
    g[b].push_back({a, i});
  }
  dfs(0);
  int cnt = 0;
  while (ans[cnt].size()) ++cnt;
  cout << cnt << endl;
  for (int(i) = (0); i < (cnt); ++(i)) {
    cout << ans[i].size() << " ";
    for (int(j) = (0); j < (ans[i].size()); ++(j)) cout << ans[i][j] << " ";
    cout << "\n";
  }
}
