#include <bits/stdc++.h>
using namespace std;
struct node {
  int u, v;
  node() {}
  node(int _u, int _v) {
    u = _u;
    v = _v;
  }
};
int n, now;
vector<int> g[100100], ans[100100];
node nodes[100100];
int dfs(int s, int pre);
int main() {
  int i, j, k, l, test, t = 1;
  scanf("%d", &n);
  for (i = 1; i < n; i++) {
    scanf("%d %d", &k, &l);
    g[k].push_back(l);
    g[l].push_back(k);
  }
  dfs(1, 1);
  printf("%d\n", now);
  for (i = 0; i < now; i++) {
    printf("2 %d %d\n", nodes[i].u, nodes[i].v);
  }
  for (i = 0; i < now; i++) {
    for (j = 0; j < ans[i].size(); j++) {
      printf("%d %d\n", i + 1, ans[i][j] + 1);
    }
  }
  return 0;
}
int dfs(int s, int pre) {
  int i, j, k, l, ret = -1;
  vector<int> v;
  for (i = 0; i < g[s].size(); i++) {
    k = g[s][i];
    if (k == pre) continue;
    nodes[now++] = node(s, k);
    v.push_back(now - 1);
    if (ret == -1) {
      ret = now - 1;
      continue;
    }
    ans[now - 2].push_back(now - 1);
  }
  int piv = now - 1, c = 0;
  for (i = 0; i < g[s].size(); i++) {
    k = g[s][i];
    if (k == pre) continue;
    int piv1 = dfs(k, s);
    piv = v[c++];
    if (piv1 == -1) continue;
    ans[piv].push_back(piv1);
  }
  return ret;
}
