#include <bits/stdc++.h>
int next[1 + (100000 - 1) * 2], hh[1 + (100000 - 1) * 2];
int link(int l, int h) {
  static int l_ = 1;
  next[l_] = l;
  hh[l_] = h;
  return l_++;
}
int ao[100000], ij[(100000 - 1)];
void dfs(int f, int i) {
  int l, h1 = -1;
  for (l = ao[i]; l; l = next[l]) {
    int h = hh[l];
    if (h != f) {
      int j;
      if (h1 == -1) {
        h1 = h;
        if (f != -1) printf("%d %d\n", f + 1, h1 + 1);
      } else
        printf("%d %d\n", h1 + 1, h + 1);
      j = i ^ ij[h];
      dfs(h, j);
    }
  }
}
int main() {
  int n, m, h, i, j;
  scanf("%d", &n);
  m = n - 1;
  printf("%d\n", m);
  for (h = 0; h < m; h++) {
    scanf("%d%d", &i, &j);
    i--, j--;
    ij[h] = i ^ j;
    printf("2 %d %d\n", i + 1, j + 1);
    ao[i] = link(ao[i], h);
    ao[j] = link(ao[j], h);
  }
  dfs(-1, 0);
  return 0;
}
