#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > edge(200005, vector<int>());
vector<vector<int> > ans(200005, vector<int>());
vector<bool> visited(200005, false);
map<pair<int, int>, int> mp;
void dfs(int i, int num) {
  visited[i] = true;
  int it = 1;
  for (auto ed : edge[i]) {
    if (!visited[ed]) {
      if (it == num) {
        it++;
      }
      ans[it].push_back(mp[{i, ed}]);
      dfs(ed, it);
      it++;
    }
  }
}
int main() {
  int n;
  cin >> n;
  vector<int> vec(n, 0);
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    int mini = min(a - 1, b - 1);
    int maxi = max(a - 1, b - 1);
    edge[mini].push_back(maxi);
    edge[maxi].push_back(mini);
    mp.insert({{mini, maxi}, i + 1});
    mp.insert({{maxi, mini}, i + 1});
    vec[a - 1]++;
    vec[b - 1]++;
  }
  dfs(0, 0);
  int res = 0;
  for (int i = 0; i < n; i++) res = max(res, vec[i]);
  cout << res << endl;
  for (int i = 0; i < n; i++) {
    if (ans[i].size() > 0) cout << ans[i].size() << " ";
    for (auto u : ans[i]) {
      cout << u << " ";
    }
    if (ans[i].size() > 0) cout << endl;
  }
}
