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