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