#include <bits/stdc++.h>
using namespace std;
int main() {
  int m;
  scanf("%d", &m);
  vector<pair<int, int> > v;
  vector<vector<int> > g(m);
  int a, b, i = 0;
  while (cin >> a >> b) {
    v.push_back(make_pair(a - 1, b - 1));
    g[a - 1].push_back(i);
    g[b - 1].push_back(i);
    i++;
  }
  printf("%d\n", m - 1);
  for (int i = 0; i < v.size(); i++) {
    printf("%d %d %d\n", 2, v[i].first + 1, v[i].second + 1);
  }
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < g[i].size() - 1; j++) {
      cout << g[i][j] + 1 << ' ' << g[i][j + 1] + 1 << endl;
    }
  }
  return 0;
}
