#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000 * 1000 * 2;
vector<pair<int, int>> gr[MAXN];
vector<int> ans[MAXN];
int check[MAXN];
void dfs(int, int);
int main() {
  int n;
  cin >> n;
  for (int i = 1; i < n; i++) {
    int u, v;
    cin >> u >> v;
    gr[u].push_back({v, i});
    gr[v].push_back({u, i});
  }
  int k = 0;
  for (int i = 1; i <= n; i++) {
    int temp = gr[i].size();
    k = max(k, temp);
  }
  dfs(1, 11111111);
  cout << k << endl;
  for (int i = 1; i <= k; i++) {
    cout << ans[i].size() << ' ';
    for (int j = 0; j < ans[i].size(); j++) {
      cout << ans[i][j] << ' ';
    }
    cout << endl;
  }
  return 0;
}
void dfs(int v, int lasd) {
  int day = 1;
  check[v] = 1;
  for (pair<int, int> u : gr[v]) {
    if (check[u.first] == false) {
      if (day == lasd) day++;
      dfs(u.first, day);
      ans[day].push_back(u.second);
      day++;
    }
  }
}
