#include <bits/stdc++.h>
using namespace std;
const int N = (int)2e5 + 1;
struct v {
  int i, c;
};
int n, a, b;
map<int, map<int, int>> tr;
int que[N], l, r;
stack<int> st;
int bV[N] = {0};
v V[N] = {0};
bool d[N] = {0};
deque<deque<int>> de;
void rec(int i = V[0].i, int c = 1) {
  for (map<int, int>::iterator it = tr[i].begin(); it != tr[i].end(); ++it) {
    if (d[it->second] != 0) continue;
    d[it->second] = c;
    de[c - 1].push_back(it->second);
    c = c % V[0].c + 1;
    rec(it->first, c);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  for (int i = 1; i < n; ++i) {
    cin >> a >> b;
    --a;
    --b;
    tr[a][b] = i;
    tr[b][a] = i;
    V[a].i = a;
    V[b].i = b;
    ++V[a].c;
    ++V[b].c;
  }
  sort(V, V + n, [](v a, v b) { return a.c > b.c; });
  de.resize(V[0].c);
  rec();
  cout << V[0].c << endl;
  for (int i = 0; i < de.size(); ++i) {
    cout << de[i].size() << ' ';
    for (int j = 0; j < de[i].size(); ++j) cout << de[i][j] << ' ';
    cout << endl;
  }
  return 0;
}
