#include <bits/stdc++.h>
using namespace std;
vector<pair<long long int, long long int>> v[200007];
vector<long long int> ans[200007];
long long int cc = 0;
void dfs(long long int x, long long int y, long long int z) {
  long long int c = 0;
  for (long long int i = 0; i < v[x].size(); i++) {
    long long int val = v[x][i].first;
    if (val == y) continue;
    c++;
    if (c == z) c++;
    cc = max(c, cc);
    ans[c].push_back(v[x][i].second);
    dfs(val, x, c);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long int t;
  t = 1;
  while (t--) {
    long long int n;
    cin >> n;
    for (long long int i = 1; i <= n - 1; i++) {
      long long int x, y;
      cin >> x >> y;
      v[x].push_back(make_pair(y, i));
      v[y].push_back(make_pair(x, i));
    }
    dfs(1, -1, 0);
    cout << cc << "\n";
    for (long long int i = 1; i <= cc; i++) {
      cout << ans[i].size() << " ";
      for (long long int j = 0; j < ans[i].size(); j++) {
        cout << ans[i][j] << " ";
      }
      cout << "\n";
    }
  }
  return 0;
}
