#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int>> adj[300001];
vector<int> parent(200001);
int cma = 0;
vector<int> make[200001];
vector<bool> visited(200001);
void dfs(int v, int p = -1) {
  visited[v] = 1;
  int cid = 0;
  for (auto it : adj[v]) {
    if (!visited[it.first]) {
      if (cid == p) cid++;
      make[cid].push_back(it.second);
      dfs(it.first, cid);
      cid++;
    }
  }
}
void solve() {
  int n;
  cin >> n;
  int ans = 0;
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    adj[a].push_back({b, i});
    adj[b].push_back({a, i});
    ans = max(ans, (int)adj[a].size());
    ans = max(ans, (int)adj[b].size());
  }
  dfs(1);
  cout << ans << endl;
  for (int i = 0; i < ans; i++) {
    cout << make[i].size() << " ";
    for (auto it : make[i]) cout << it + 1 << " ";
    cout << endl;
  }
  cout << endl;
}
int main() {
  int t = 1;
  while (t--) solve();
  return 0;
}
