#include <bits/stdc++.h>
using namespace std;
int n, m, mcnt, pre[100005];
struct edge {
  int x, next;
} e[100005 << 1];
void work() {
  int i, x, y;
  scanf("%d", &n);
  printf("%d\n", n - 1);
  memset(pre, -1, sizeof(pre));
  for (i = 1; i < n; ++i) {
    scanf("%d%d", &x, &y);
    printf("2 %d %d\n", x, y);
    e[mcnt] = (edge){i, pre[x]}, pre[x] = mcnt++;
    e[mcnt] = (edge){i, pre[y]}, pre[y] = mcnt++;
  }
  for (x = 1; x <= n; ++x)
    for (i = pre[x]; ~i && ~e[i].next; i = e[i].next)
      printf("%d %d\n", e[i].x, e[e[i].next].x);
}
int main() {
  work();
  return 0;
}
