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