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