#include <bits/stdc++.h>
using namespace std;
const int LEN = 200200;
vector<int> ed[LEN];
vector<pair<int, int> > res[LEN];
int n, a, b, use[LEN], k;
map<int, int> q[LEN];
void dfs(int v, int d) {
  int u, k = 1;
  use[v] = 1;
  for (int i = 0; i < ed[v].size(); i++) {
    u = ed[v][i];
    if (use[u]) continue;
    if (k == d) k++;
    res[k].push_back(make_pair(v, u));
    dfs(u, k);
    k++;
  }
}
int main() {
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    scanf("%i %i", &a, &b);
    ed[a - 1].push_back(b - 1);
    ed[b - 1].push_back(a - 1);
    q[a - 1][b - 1] = q[b - 1][a - 1] = i + 1;
  }
  dfs(0, 0);
  for (int i = 1; i < LEN; i++)
    if (res[i].size() == 0) {
      k = i - 1;
      break;
    }
  cout << k << endl;
  for (int i = 1; i <= k; i++) {
    printf("%i ", res[i].size());
    for (int j = 0; j < res[i].size(); j++)
      printf("%i ", q[res[i][j].first][res[i][j].second]);
    printf("\n");
  }
  return 0;
}
