#include <bits/stdc++.h>
using namespace std;
const int maxn = 100007;
vector<int> a[maxn];
map<pair<int, int>, bool> mark;
map<pair<int, int>, int> id;
int n, deg[maxn];
void DFS(int u, int v) {
  int x, y;
  for (int i = 0, _a = (int(a[v].size())); i < _a; ++i) {
    x = a[v][i];
    if (x == u) continue;
    if (!mark[pair<int, int>(v, x)]) {
      mark[pair<int, int>(v, x)] = mark[pair<int, int>(x, v)] = 1;
      printf("%d %d\n", id[pair<int, int>(u, v)], id[pair<int, int>(v, x)]);
      DFS(v, x);
    }
  }
}
int main() {
  scanf("%d", &n);
  int u, v;
  printf("%d\n", n - 1);
  memset(deg, 0, sizeof(deg));
  for (int i = 1, _c = n - 1; i <= _c; i++) {
    scanf("%d%d", &u, &v);
    if (u > v) swap(u, v);
    a[u].push_back(v);
    a[v].push_back(u);
    id[pair<int, int>(u, v)] = i;
    id[pair<int, int>(v, u)] = i;
    deg[u]++;
    deg[v]++;
    printf("2 %d %d\n", u, v);
  }
  u = 0;
  for (int i = 1, _c = n; i <= _c; i++)
    if (deg[i] == 1) {
      u = i;
      break;
    }
  mark[pair<int, int>(u, a[u][0])] = mark[pair<int, int>(a[u][0], v)] = 0;
  DFS(u, a[u][0]);
  return 0;
}
