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