#include <bits/stdc++.h>
using namespace std;
vector<int> edges[200005];
int n;
int a[200005];
int b[200005];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) edges[i].clear();
  for (int i = 1; i < n; i++) {
    scanf("%d%d", &a[i], &b[i]);
    edges[a[i]].push_back(i);
    edges[b[i]].push_back(i);
  }
  printf("%d\n", n - 1);
  for (int i = 1; i < n; i++) {
    printf("2 %d %d\n", a[i], b[i]);
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < edges[i].size() - 1; j++)
      printf("%d %d\n", edges[i][j], edges[i][j + 1]);
  }
  return 0;
}
