#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> adj[100500];
vector<pair<int, int> > no;
vector<pair<int, int> > edges;
int rep[100500];
int main() {
  scanf("%d", &n);
  memset(rep, -1, sizeof(rep));
  for (int i = 0; i < (n - 1); i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    u--;
    v--;
    no.push_back(make_pair(u, v));
    int x = rep[u];
    if (x == -1) {
      rep[u] = i;
    } else
      edges.push_back(make_pair(i, x));
    x = rep[v];
    if (x == -1) {
      rep[v] = i;
    } else
      edges.push_back(make_pair(i, x));
  }
  printf("%d\n", (int)no.size());
  for (int i = 0; i < (n - 1); i++) {
    printf("2 %d %d\n", no[i].first + 1, no[i].second + 1);
  }
  for (int i = 0; i < (edges.size()); i++) {
    printf("%d %d\n", edges[i].first + 1, edges[i].second + 1);
  }
  return 0;
}
