#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 3;
vector<vector<pair<long long, long long>>> v(N);
vector<vector<long long>> day;
void dfs(long long x, long long d, long long p) {
  long long temp = d;
  long long m = day.size();
  for (pair<long long, long long> i : v[x]) {
    if (i.first != p) {
      day[d].push_back(i.second);
      d = (d + 1) % m;
    }
  }
  d = temp;
  for (pair<long long, long long> i : v[x]) {
    if (i.first != p) {
      dfs(i.first, (d + 1) % m, x);
      d = (d + 1) % m;
    }
  }
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, m;
  cin >> n;
  m = n - 1;
  long long ans = 0;
  for (long long i = 0; i < m; ++i) {
    long long a, b;
    cin >> a >> b;
    v[a].push_back({b, i + 1});
    v[b].push_back({a, i + 1});
    ans = max({ans, (long long)v[a].size(), (long long)v[b].size()});
  }
  day.resize(ans);
  cout << ans << "\n";
  if (ans == 0) return 0;
  dfs(1, 0, -1);
  for (vector<long long> i : day) {
    cout << i.size() << " ";
    for (long long j : i) cout << j << " ";
    cout << '\n';
  }
  return 0;
}
