#include <bits/stdc++.h>
using namespace std;
vector<vector<pair<int, int>>> vi;
vector<vector<int>> days;
long long result;
long long vis[10000000];
void dfs(int node, int lastday) {
  if (vis[node]) return;
  vis[node] = 1;
  long long day = 1;
  for (int nodes = 0; nodes < vi[node].size(); nodes++) {
    int n = vi[node][nodes].first;
    if (vis[n]) continue;
    if (lastday == day) day++;
    days[day].push_back(vi[node][nodes].second);
    dfs(n, day);
    result = max(result, day);
    day++;
  }
}
int main() {
  long long n;
  cin >> n;
  days.resize(n + 1);
  vi.resize(n + 1);
  for (int i = 1; i < n; i++) {
    int from, to;
    cin >> from >> to;
    from--;
    to--;
    vi[from].push_back(make_pair(to, i));
    vi[to].push_back(make_pair(from, i));
  }
  dfs(0, 0);
  cout << result << endl;
  for (int i = 1; i <= result; i++) {
    cout << days[i].size();
    for (int j = 0; j < days[i].size(); j++) {
      cout << " " << days[i][j];
    }
    cout << endl;
  }
  return 0;
}
