#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cout << name << " : " << arg1 << '\n';
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cout.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
const long long int N = 200005;
vector<vector<pair<long long int, long long int>>> gr;
long long int vis[N];
vector<long long int> res[N];
bool comp(vector<pair<long long int, long long int>>& a,
          vector<pair<long long int, long long int>>& b) {
  return a.size() > b.size();
}
void dfs(long long int cur, long long int par, long long int col) {
  long long int cnt = 1;
  for (auto x : gr[cur])
    if (x.first != par) {
      if (cnt == col) cnt++;
      vis[x.second] = cnt;
      dfs(x.first, cur, cnt);
      cnt++;
    }
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  {
    long long int i, j, k, n, m, ans = 0, cnt = 0, sum = 0;
    cin >> n;
    m = n - 1;
    gr.resize(N);
    for (i = 0; i < m; i++) {
      long long int x, y;
      cin >> x >> y;
      gr[x].push_back({y, i});
      gr[y].push_back({x, i});
    }
    dfs(1, 0, 0);
    long long int mx = 0;
    for (i = 0; i < n; i++) {
      cnt = 0;
      for (auto x : gr[i]) {
        res[vis[x.second]].push_back(x.second);
        mx = max(vis[x.second], mx);
      }
    }
    cout << mx << '\n';
    for (i = 1; i <= mx; i++) {
      sort(res[i].begin(), res[i].end());
      res[i].resize(unique(res[i].begin(), res[i].end()) - res[i].begin());
      cout << res[i].size() << " ";
      for (auto x : res[i]) {
        cout << x + 1 << " ";
      }
      cout << '\n';
    }
  }
}
