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