#include <bits/stdc++.h>
using namespace std;
int N, i, a, b, j;
vector<int> G[100010];
int main() {
  cin >> N;
  cout << N - 1 << '\n';
  for (i = 1; i < N; i++) {
    cin >> a >> b;
    G[a].push_back(i);
    G[b].push_back(i);
    cout << 2 << ' ' << a << ' ' << b << '\n';
  }
  for (i = 1; i <= N; i++)
    for (j = 1; j < G[i].size(); j++)
      cout << G[i][j - 1] << ' ' << G[i][j] << '\n';
  return 0;
}
