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