#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:16777216")
#pragma warning(disable : 4786)
pair<int, int> e[1000002];
int fp[1000002];
int main() {
  int n, i, j, x, y;
  cin >> n;
  n--;
  for (i = 1; i <= n; i++) {
    cin >> e[i].first >> e[i].second;
    if (e[i].first > e[i].second) swap(e[i].first, e[i].second);
  }
  sort(e + 1, e + n + 1);
  cout << n << endl;
  for (i = 1; i <= n; i++) {
    cout << 2 << " " << e[i].first << " " << e[i].second << endl;
    if (fp[e[i].first] == 0) {
      fp[e[i].first] = i;
    }
    if (fp[e[i].second] == 0) {
      fp[e[i].second] = i;
    }
  }
  for (i = 1; i <= n; i++) {
    x = e[i].first;
    y = e[i].second;
    if (fp[x] != i) cout << i << " " << fp[x] << endl;
    if (fp[y] != i) cout << i << " " << fp[y] << endl;
  }
  return 0;
}
