#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5;
struct edge {
  int to, id;
};
vector<edge> g[maxn];
vector<int> res[maxn];
void dfs(int v, int p, int f) {
  int c = 0;
  for (auto &e : g[v]) {
    if (e.to == p) {
      continue;
    }
    if (c == f) {
      ++c;
    }
    res[c].push_back(e.id);
    dfs(e.to, v, c);
    ++c;
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int n;
  cin >> n;
  for (int i = 0; i + 1 < n; ++i) {
    int a, b;
    cin >> a >> b;
    --a;
    --b;
    g[a].push_back({b, i});
    g[b].push_back({a, i});
  }
  dfs(0, -1, -1);
  int c = 0;
  for (int i = 0; i < n; ++i) {
    c = max(c, (int)g[i].size());
  }
  cout << c << '\n';
  for (int i = 0; i < c; ++i) {
    cout << res[i].size() << ' ';
    for (auto &e : res[i]) {
      cout << e + 1 << ' ';
    }
    cout << '\n';
  }
  return 0;
}
