#include <bits/stdc++.h>
using namespace std;
vector<int> v[200005];
vector<pair<int, int> > adj[200005];
int n, a, b, tot;
void dfs(int pos, int par, int used) {
  int start = 0, baby, path, j;
  for (int i = 0; i < adj[pos].size(); i++) {
    baby = adj[pos][i].first;
    path = adj[pos][i].second;
    if (baby != par) {
      j = start;
      if (j != used) {
        v[j].push_back(path);
        dfs(baby, pos, j);
        start = j + 1;
        tot = max(tot, j + 1);
      } else {
        dfs(baby, pos, j + 1);
        v[j + 1].push_back(path);
        tot = max(j + 2, tot);
        start = j + 2;
      }
    }
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i < n; i++) {
    cin >> a >> b;
    adj[a].push_back({b, i});
    adj[b].push_back({a, i});
  }
  dfs(1, 0, -1);
  cout << tot << "\n";
  for (int i = 0; i < tot; i++) {
    cout << v[i].size() << " ";
    for (int j = 0; j < v[i].size(); j++) {
      cout << v[i][j] << " ";
    }
    cout << "\n";
  }
  return 0;
}
