#include <bits/stdc++.h>
const int NUM = 100010;
const double eps = 1e-10, pi = acos(-1.0);
using namespace std;
int n;
vector<int> g[NUM];
pair<int, int> node[NUM], edge[NUM];
int tot, cnt;
void dfs(int u, int p, int x) {
  for (int i = 0; i < g[u].size(); i++)
    if (g[u][i] != p) {
      node[tot++] = pair<int, int>(u, g[u][i]);
      if (x == -1)
        x = tot - 1;
      else
        edge[cnt++] = pair<int, int>(x + 1, tot);
      dfs(g[u][i], u, tot - 1);
    }
}
int main() {
  int i, j;
  int u, v;
  scanf("%d", &n);
  for (i = 1; i < n; i++) {
    scanf("%d%d", &u, &v);
    g[u].push_back(v);
    g[v].push_back(u);
  }
  dfs(1, -1, -1);
  printf("%d\n", tot);
  for (i = 0; i < tot; i++) printf("2 %d %d\n", node[i].first, node[i].second);
  for (i = 0; i < cnt; i++) printf("%d %d\n", edge[i].first, edge[i].second);
  return 0;
}
