#include <bits/stdc++.h>
using namespace std;
int N, M, K, viz[100100];
vector<int> G[100100];
pair<int, int> edges[100100], nodes[100100];
void dfs(int x, int par) {
  int ant = -1;
  for (int i = 0; i < G[x].size(); i++)
    if (!viz[G[x][i]]) {
      viz[G[x][i]] = 1;
      nodes[++M].first = x, nodes[M].second = G[x][i];
      if (ant != -1) edges[++K] = make_pair(ant, M);
      ant = M;
      dfs(G[x][i], M);
    }
  if (ant != -1 && par != -1) edges[++K] = make_pair(ant, par);
}
void read_data() {
  scanf("%d", &N);
  int i, a, b;
  for (i = 1; i < N; i++)
    scanf("%d %d", &a, &b), G[a].push_back(b), G[b].push_back(a);
}
void write_data(void) {
  int i, a, b;
  printf("%d\n", M);
  for (i = 1; i <= M; i++) printf("2 %d %d\n", nodes[i].first, nodes[i].second);
  for (i = 1; i <= K; i++) printf("%d %d\n", edges[i].first, edges[i].second);
}
int main() {
  read_data();
  viz[1] = 1;
  dfs(1, -1);
  write_data();
  return 0;
}
