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