#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const long double pi = acos(-1.0);
const string debug_line = "yolo";
const long double PI = acos((long double)-1.0);
const long double eps = 1e-6;
unsigned long long getRand() {
  return ((unsigned long long)rand() << 40) +
         ((unsigned long long)rand() << 20) + ((unsigned long long)rand());
}
vector<int> answers[200010];
vector<pair<int, int> > Adj[200010];
int maxAnswer;
set<int> usedTime[200010];
void DFS(int u, int p, int timer) {
  usedTime[u].insert(timer);
  int curr = 1;
  for (auto &(t1) : (Adj[u])) {
    if (p != t1.first) {
      if (usedTime[u].find(curr) != usedTime[u].end()) {
        curr++;
      }
      maxAnswer = max(maxAnswer, curr);
      usedTime[u].insert(curr);
      answers[curr].push_back(t1.second);
      DFS(t1.first, u, curr);
      curr++;
    }
  }
}
int main() {
  int n;
  scanf("%d", &n);
  for (int(i) = (1); (i) < (n); ++(i)) {
    int a1, b1;
    scanf("%d%d", &a1, &b1);
    Adj[a1].push_back(make_pair(b1, i));
    Adj[b1].push_back(make_pair(a1, i));
  }
  DFS(1, 0, 0);
  printf("%d\n", maxAnswer);
  for (int(i) = (1); (i) < (maxAnswer + 1); ++(i)) {
    printf("%d ", (int)answers[i].size());
    for (auto &(edge) : (answers[i])) {
      printf("%d ", edge);
    }
    printf("\n");
  }
  return 0;
}
