#include <bits/stdc++.h>
using namespace std;
const int M = 200005;
const int mod = 1e9 + 7;
map<int, int> id[M];
vector<int> adj[M], ans[M];
int n, mans;
void dfs(int node, int p, int l) {
  mans = max(mans, (int)adj[node].size());
  int turn = 1;
  for (auto i : adj[node]) {
    if (i == p) continue;
    if (turn == l) ++turn;
    ans[turn].push_back(id[node][i]);
    dfs(i, node, turn);
    ++turn;
  }
  return;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i < n; ++i) {
    int a, b;
    cin >> a >> b;
    adj[a].push_back(b);
    adj[b].push_back(a);
    id[a][b] = i;
    id[b][a] = i;
  }
  dfs(1, 0, 0);
  cout << mans << "\n";
  for (int i = 1; i <= mans; ++i) {
    cout << ans[i].size() << " ";
    for (auto j : ans[i]) cout << j << " ";
    cout << "\n";
  }
  return 0;
}
