#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > G[1000000];
vector<pair<int, int> > edges;
int n;
void dfs(int v, int p, int e) {
  for (int i = 0; i < G[v].size(); i++) {
    if (G[v][i].first != p) {
      dfs(G[v][i].first, v, G[v][i].second);
      if (e != -1) printf("%d %d\n", e, G[v][i].second);
      e = G[v][i].second;
    }
  }
}
int main() {
  scanf("%d", &n);
  edges.push_back(make_pair(0, 0));
  for (int i = 1; i <= n - 1; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    G[a - 1].push_back(make_pair(b - 1, i));
    G[b - 1].push_back(make_pair(a - 1, i));
    edges.push_back(make_pair(a, b));
  }
  printf("%d\n", n - 1);
  for (int i = 1; i <= n - 1; i++)
    printf("2 %d %d\n", edges[i].first, edges[i].second);
  dfs(0, -1, -1);
  return 0;
}
