#include <bits/stdc++.h>
using namespace std;
int cunt[200000 + 342];
bool printed[200000 + 342];
vector<pair<int, int> > adj[200000 + 342];
int pussy[200000 + 342];
vector<int> bc[200000 + 342];
void solve(int cur, int par, int t) {
  int now = 0;
  for (int i = 0; i < adj[cur].size(); i++) {
    int nxt = adj[cur][i].first;
    if (nxt == par) {
      continue;
    }
    now++;
    if (now == t) {
      now++;
    }
    bc[now].push_back(adj[cur][i].second);
    solve(nxt, cur, now);
  }
}
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  int x, y;
  set<int> nodes;
  int ans = 0;
  for (int k = 1; k < n; k++) {
    cin >> x >> y;
    cunt[x]++;
    cunt[y]++;
    if (cunt[x] > 1) nodes.insert(x);
    if (cunt[y] > 1) nodes.insert(y);
    adj[x].push_back(make_pair(y, k));
    adj[y].push_back(make_pair(x, k));
    ans = max(ans, max(cunt[x], cunt[y]));
  }
  if (n == 2) {
    cout << "1\n1 1";
    return 0;
  }
  cout << ans << "\n";
  int vis = 0;
  int day = 0;
  solve(1, -1, 0);
  for (int i = 1; i <= ans; i++) {
    cout << bc[i].size() << " ";
    for (int j = 0; j < bc[i].size(); j++) {
      cout << bc[i][j] << " ";
    }
    cout << "\n";
  }
  return 0;
}
