#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > adjList[200010];
vector<int> day[200010];
void dfs(int u, int p, int sk) {
  int currd = 0;
  for (auto x : adjList[u]) {
    int v = x.first;
    if (v == p) continue;
    if (currd == sk) currd += 1;
    day[currd].push_back(x.second);
    dfs(v, u, currd);
    currd += 1;
  }
}
int main() {
  int N;
  scanf("%d", &N);
  for (int i = 0; i + 1 < N; i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    adjList[u].push_back(make_pair(v, i + 1));
    adjList[v].push_back(make_pair(u, i + 1));
  }
  int maxidx = 1;
  for (int i = 1; i <= N; i++)
    if (adjList[i].size() > adjList[maxidx].size()) maxidx = i;
  dfs(maxidx, -1, -1);
  cout << adjList[maxidx].size() << endl;
  for (int i = 0; i < adjList[maxidx].size(); i++) {
    cout << day[i].size() << " ";
    for (int j = 0; j < day[i].size(); j++) cout << day[i][j] << " ";
    cout << endl;
  }
  return 0;
}
