#include <bits/stdc++.h>
using namespace std;
int n;
int a[100005], b[100005];
vector<int> e[100005];
inline void addEdge(int u, int v) { e[u].push_back(v); }
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch > '9' || ch < '0') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
inline void write(int x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  if (x >= 10) write(x / 10);
  putchar(x % 10 + '0');
}
int main() {
  n = read();
  for (int i = 1; i < n; i++)
    a[i] = read(), b[i] = read(), addEdge(a[i], i), addEdge(b[i], i);
  printf("%d\n", n - 1);
  for (int i = 1; i <= n - 1; i++) printf("2 %d %d\n", a[i], b[i]);
  for (int i = 1; i <= n; i++)
    for (int j = 0; j < e[i].size() - 1; j++)
      printf("%d %d\n", e[i][j], e[i][j + 1]);
  return 0;
}
