#include <bits/stdc++.h>
using namespace std;
int n, ans;
vector<int> v[200010], v_ans[200010];
map<pair<int, int>, int> m;
void dfs(int node, int par, int col) {
  ans = max(ans, col);
  int c = 1;
  for (int i = 0; i < v[node].size(); i++) {
    if (v[node][i] == par) continue;
    if (c == col) c++;
    dfs(v[node][i], node, c);
    v_ans[c++].push_back(m[make_pair(node, v[node][i])]);
  }
}
int main() {
  cin >> n;
  for (int i = 1; i < n; i++) {
    int x, y;
    cin >> x >> y;
    v[x].push_back(y), v[y].push_back(x);
    m[make_pair(x, y)] = i, m[make_pair(y, x)] = i;
  }
  dfs(1, 0, 0);
  cout << ans << endl;
  for (int i = 1; i <= ans; i++) {
    cout << v_ans[i].size();
    for (int j = 0; j < v_ans[i].size(); j++) {
      cout << ' ' << v_ans[i][j];
    }
    cout << endl;
  }
}
