#include <bits/stdc++.h>
using namespace std;
const int N = (int)2e5 + 5;
const int INF = (int)1e9;
const int mod = (int)1e9 + 7;
const long long LLINF = (long long)1e18;
int n;
vector<pair<int, int> > g[N];
vector<int> roads[N];
void dfs(int v, int p = -1, int id = -1) {
  int pos = -1;
  for (auto t : g[v]) {
    int to = t.first;
    int num = t.second;
    if (to == p) continue;
    ++pos;
    if (pos == id) ++pos;
    roads[pos].push_back(num);
    dfs(to, v, pos);
  }
}
int main() {
  cin >> n;
  for (int i = 1; i < n; ++i) {
    int x, y;
    cin >> x >> y;
    --x;
    --y;
    g[x].push_back({y, i});
    g[y].push_back({x, i});
  }
  dfs(0);
  int cnt = 0;
  for (int i = 0; i < N; ++i) {
    if (roads[i].size() > 0) ++cnt;
  }
  cout << cnt << '\n';
  for (int i = 0; i < cnt; ++i) {
    cout << roads[i].size() << ' ';
    for (int r : roads[i]) cout << r << ' ';
    cout << '\n';
  }
  return 0;
}
