#include <bits/stdc++.h>
using namespace std;
map<pair<int, int>, int> mp;
inline pair<int, int> mymake(int x, int y) {
  return x > y ? pair<int, int>(y, x) : pair<int, int>(x, y);
}
inline pair<int, int> mymake_rev(int x, int y) {
  return y > x ? pair<int, int>(y, x) : pair<int, int>(x, y);
}
int n;
int cnt;
vector<pair<int, int> > adj;
int fa[111111];
int find(int x) { return x == fa[x] ? x : fa[x] = find(fa[x]); }
int main() {
  scanf("%d", &n);
  printf("%d\n", n - 1);
  for (int i = 1; i < n; i++) {
    int f, t;
    scanf("%d%d", &f, &t);
    printf("2 %d %d\n", f, t);
    cnt++;
    mp[mymake(f, t)] = cnt;
    mp[mymake_rev(f, t)] = cnt;
    adj.push_back(mymake(f, t));
    adj.push_back(mymake_rev(f, t));
  }
  sort(adj.begin(), adj.end());
  for (int i = 1; i <= cnt; i++) fa[i] = i;
  for (int i = 0; i < adj.size();) {
    int nexti = i;
    while (nexti < adj.size() && adj[nexti].first == adj[i].first) nexti++;
    for (int j = i; j < nexti; j++) {
      int x = mp[adj[i]];
      int fx = find(x);
      int y = mp[adj[j]];
      int fy = find(y);
      if (fx == fy) continue;
      printf("%d %d\n", x, y);
      fa[fx] = fy;
    }
    i = nexti;
  }
  return 0;
}
