#include <bits/stdc++.h>
using namespace std;
const int maxx = 1e5 + 20;
vector<int> ans[maxx];
int co = 0;
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  cout << n - 1 << endl;
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    cout << 2 << " " << a << " " << b << endl;
    a--, b--;
    ans[a].push_back(i + 1);
    ans[b].push_back(i + 1);
  }
  for (int i = 0; i < n; i++) {
    if (ans[i].size() <= 1) continue;
    for (int j = 0; j < ans[i].size() - 1; j++)
      cout << ans[i][j] << " " << ans[i][j + 1] << endl;
  }
  return 0;
}
