#include <bits/stdc++.h>
using namespace std;
typedef struct {
  int sum, suf, pre, max;
} Node;
int toint(const string &s) {
  stringstream ss;
  ss << s;
  int x;
  ss >> x;
  return x;
}
const int MAXN = 2e5 + 100;
const int UP = 31;
const long long int highest = 1e18;
const double pi = acos(-1);
const double Phi = 1.618033988749894;
const int logn = 20;
const double root5 = 2.236067977;
const int mod = 1e9 + 7;
const int ini = -1e9;
const int N = 2e5 + 200;
std::vector<int> gr[N];
std::vector<int> id[N];
const int rt = 0;
std::vector<int> res[N];
int wrst = 0;
int n;
void dfs(int u, int par = -1, int badt = -1) {
  wrst = max(wrst, (int)gr[u].size());
  int t = 0;
  if (t == badt) {
    ++t;
  }
  for (int i = 0; i < gr[u].size(); ++i) {
    int v = gr[u][i];
    if (v == par) {
      continue;
    }
    int curday = t;
    res[t].push_back(id[u][i]);
    ++t;
    if (t == badt) {
      ++t;
    }
    dfs(v, u, curday);
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n - 1; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    --u, --v;
    gr[u].push_back(v);
    gr[v].push_back(u);
    id[u].push_back(i);
    id[v].push_back(i);
  }
  dfs(rt);
  cout << wrst << "\n";
  for (int i = 0; i < wrst; ++i) {
    cout << (res[i].size()) << " ";
    for (int c : res[i]) {
      cout << (c + 1) << " ";
    }
    cout << "\n";
  }
  return 0;
}
