#include <bits/stdc++.h>
using namespace std;
const int INF = int(1e9);
const long long INFll = 1ll * INF * INF;
const long double ldINF = 1e+018;
const long double EPS = 0.000000001;
const int N = 100001;
template <typename T>
ostream& operator<<(ostream& out, pair<T, T>& a) {
  out << a.first << " " << a.second;
  return out;
}
template <typename T>
istream& operator>>(istream& in, pair<T, T>& a) {
  in >> a.first >> a.second;
  return in;
}
template <typename T>
ostream& operator<<(ostream& out, vector<pair<T, T> > a) {
  for (int i = 0; i < a.size(); ++i) out << a[i] << endl;
  return out;
}
template <typename T>
istream& operator>>(istream& in, vector<T>& a) {
  for (int i = 0; i < a.size(); ++i) in >> a[i];
  return in;
}
template <typename T>
ostream& operator<<(ostream& out, vector<T> a) {
  for (int i = 0; i < a.size(); ++i)
    if (i == a.size() - 1)
      out << a[i];
    else
      out << a[i] << " ";
  return out;
}
vector<pair<int, int> > g[200100];
int ans[200100];
vector<int> f[200100];
void dfs(int v, int p, int pcol) {
  int cur = 1;
  for (int i = 0; i < g[v].size(); i++) {
    int to = g[v][i].first, num = g[v][i].second;
    if (to == p) continue;
    if (cur == pcol) cur++;
    ans[num] = cur++;
    dfs(to, v, ans[num]);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    g[a].push_back(make_pair(b, i));
    g[b].push_back(make_pair(a, i));
  }
  dfs(0, -1, -1);
  int mx = 0;
  for (int i = 0; i < n - 1; i++) {
    mx = max(mx, ans[i]);
    f[ans[i]].push_back(i + 1);
  }
  cout << mx << endl;
  for (int i = 1; i <= mx; i++) {
    cout << f[i].size() << ' ';
    for (int j = 0; j < f[i].size(); j++) cout << f[i][j] << ' ';
    cout << endl;
  }
  if (0)
    cerr << fixed << setprecision(0)
         << "TIME = " << clock() / (long double)CLOCKS_PER_SEC * 1000 << "\n";
  return 0;
}
