#include <bits/stdc++.h>
using namespace std;
vector<vector<pair<int, int> > > vec;
vector<vector<int> > ans;
void w(int v, int u, int k) {
  int k2 = 1;
  for (int i = 0; i < vec[v].size(); ++i) {
    if (k2 == k) {
      ++k2;
    }
    if (vec[v][i].first == u) {
      continue;
    }
    ans[k2].push_back(vec[v][i].second);
    w(vec[v][i].first, v, k2);
    ++k2;
  }
}
int main() {
  int n;
  cin >> n;
  vec.resize(n + 1);
  ans.resize(n + 1);
  for (int i = 0; i < n - 1; ++i) {
    int a, b;
    cin >> a >> b;
    vec[a].push_back({b, i});
    vec[b].push_back({a, i});
  }
  w(1, -1, 0);
  int z = 0;
  for (int i = 0; i < ans.size(); ++i) {
    if (ans[i].size() != 0) {
      ++z;
    }
  }
  cout << z << endl;
  for (int i = 0; i < ans.size(); ++i) {
    if (ans[i].size() != 0) {
      cout << ans[i].size() << ' ';
      for (int j = 0; j < ans[i].size(); ++j) {
        cout << ans[i][j] + 1 << ' ';
      }
      cout << endl;
    }
  }
}
