#include <bits/stdc++.h>
std::vector<int> v[100050];
std::vector<int> vv[100050];
struct ed {
  int a, b, c;
} ed[100050];
int x, y, m, n;
int main() {
  int i, j, k;
  scanf("%d", &n);
  printf("%d\n", n - 1);
  for (i = 1; i <= n - 1; i++) {
    scanf("%d%d", &x, &y);
    v[x].push_back(i);
    v[y].push_back(i);
    printf("2 %d %d\n", x, y);
  }
  for (i = 1; i <= n; i++) {
    x = v[i].size();
    if (x >= 2) {
      for (j = 0; j < x - 1; j++) {
        printf("%d %d\n", v[i][j], v[i][j + 1]);
      }
    }
  }
  getchar();
  getchar();
}
