#include <bits/stdc++.h>
using namespace std;
map<pair<int, int>, int> ord;
vector<pair<int, int> > edges;
vector<int> adj[200000];
int n;
int main() {
  cin >> n;
  cout << n - 1 << endl;
  for (int i = 1; i < n; i++) {
    int a, b;
    cin >> a >> b;
    edges.push_back(make_pair(a, b));
    ord[make_pair(a, b)] = ord[make_pair(b, a)] = i;
    adj[a].push_back(b);
    adj[b].push_back(a);
    cout << "2 " << a << " " << b << endl;
  }
  for (int i = 1; i <= n; i++)
    for (int j = 0; j < adj[i].size() - 1; j++)
      cout << ord[make_pair(i, adj[i][j])] << " "
           << ord[make_pair(i, adj[i][j + 1])] << endl;
}
