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