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