#include <bits/stdc++.h>
using namespace std;
vector<int> e[111111];
int n, m, xp, d[111111], cl[111111], tr[111111], sh[111111];
void inp() {
  scanf("%d", &n);
  int u, v;
  for (int i = 1; i <= n - 1; ++i) {
    scanf("%d%d", &u, &v);
    e[u].push_back(v), e[v].push_back(u);
    ++d[u], ++d[v];
  }
}
void dfs(int u) {
  cl[u] = 1;
  for (typeof((e[u]).begin()) it = (e[u]).begin(); it != (e[u]).end(); ++it) {
    int v = *it;
    if (!cl[v]) tr[v] = u, dfs(v);
  }
}
void solve() {
  for (int i = n; i >= 1; --i)
    if (d[i] == 1) xp = i;
  dfs(xp);
  for (int i = 1; i <= n; ++i)
    if (i != xp) sh[i] = ++m;
  printf("%d\n", m);
  for (int i = 1; i <= n; ++i)
    if (i != xp) {
      printf("2 %d %d\n", i, tr[i]);
    }
  for (int i = 1; i <= n; ++i)
    if (i != xp && tr[i] != xp) {
      printf("%d %d\n", sh[i], sh[tr[i]]);
    }
}
int main() {
  inp();
  solve();
  return 0;
}
