#include <bits/stdc++.h>
int n, num;
int v[100001];
struct node {
  int point, link;
} list[199999];
void join(int a, int b) {
  num++;
  list[num].point = b;
  list[num].link = v[a];
  v[a] = num;
}
int main() {
  int i, j, k, a, b;
  scanf("%d", &n);
  printf("%d\n", n - 1);
  num = 0;
  memset(v, 0, sizeof(v));
  for (i = 1; i <= n - 1; i++) {
    scanf("%d%d", &a, &b);
    printf("2 %d %d\n", a, b);
    join(a, b);
    join(b, a);
  }
  for (i = 1; i <= n; i++) {
    j = v[i];
    k = list[j].link;
    while (k != 0) {
      printf("%d %d\n", (j + 1) / 2, (k + 1) / 2);
      j = k;
      k = list[k].link;
    }
  }
  return 0;
}
