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