#include <bits/stdc++.h>
using namespace std;
map<pair<int, int>, int> id;
vector<int> a[100005];
int main() {
  int i, j, k, n;
  cin >> n;
  cout << n - 1 << endl;
  int idd = 1;
  for (k = (1); k <= (n - 1); k++) {
    cin >> i >> j;
    a[i].push_back(j);
    a[j].push_back(i);
    id[make_pair(i, j)] = idd;
    id[make_pair(j, i)] = idd++;
    printf("2 %d %d\n", i, j);
  }
  for (i = (1); i <= (n); i++)
    for (j = 1; j < a[i].size(); j++) {
      cout << id[make_pair(i, a[i][j - 1])] << " " << id[make_pair(i, a[i][j])]
           << endl;
    }
  return 0;
}
