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