#include <bits/stdc++.h>
using namespace std;
int N;
vector<int> G[100005], S[100005], T[100005], C[100005];
int nodes;
void recon(int nod, int fat) {
  for (int i = 0; i < G[nod].size(); ++i) {
    int nnod = G[nod][i];
    if (nnod != fat) {
      S[nod].push_back(nnod);
      recon(nnod, nod);
    }
  }
}
void baga(int nods, int nodt) {
  for (int i = 0; i < S[nods].size(); ++i) {
    int nnod = S[nods][i];
    ++nodes;
    C[nodes].push_back(nods);
    C[nodes].push_back(nnod);
    T[nodt].push_back(nodes);
    baga(nnod, nodes);
  }
}
int main() {
  scanf("%d", &N);
  for (int i = 1; i < N; ++i) {
    int a, b;
    scanf("%d %d", &a, &b);
    G[a].push_back(b);
    G[b].push_back(a);
  }
  recon(1, 0);
  baga(1, 0);
  for (int i = 1; i < T[0].size(); ++i) T[1].push_back(T[0][i]);
  T[0].clear();
  printf("%d\n", nodes);
  for (int i = 1; i <= nodes; ++i) {
    printf("%d ", C[i].size());
    for (int j = 0; j < C[i].size(); ++j) printf("%d ", C[i][j]);
    printf("\n");
  }
  for (int i = 1; i <= nodes; ++i)
    if (T[i].size())
      for (int j = 0; j < T[i].size(); ++j) printf("%d %d\n", i, T[i][j]);
  return 0;
}
