#include <bits/stdc++.h>
using namespace std;
int n, m, l[200005], E, qd[200005], qn[200005], UA[200005], UB[200005],
    EA[200005], EB[200005];
int ret, a, b;
void bd(int x, int y) {
  qd[E] = y;
  qn[E] = l[x];
  l[x] = E;
  ++E;
}
void DFS(int x, int y, int pre) {
  int fir = 1, t;
  for (int k = l[x]; k != -1; k = qn[k]) {
    if (qd[k] == y) continue;
    if (fir) {
      fir = 0, t = k;
      if (pre != -1) {
        EA[ret] = pre / 2;
        EB[ret] = k / 2;
        ret++;
      }
    } else {
      EA[ret] = t / 2;
      EB[ret] = k / 2;
      ret++;
    }
    DFS(qd[k], x, k);
  }
}
int main() {
  scanf("%d", &n);
  for (int i = (1); i <= (n); i++) l[i] = -1;
  E = 0;
  for (int i = (0); i < (n - 1); i++) {
    scanf("%d%d", &a, &b);
    bd(a, b);
    bd(b, a);
    UA[i] = a;
    UB[i] = b;
  }
  ret = 0;
  DFS(1, 0, -1);
  printf("%d\n", n - 1);
  for (int i = (0); i < (n - 1); i++) printf("2 %d %d\n", UA[i], UB[i]);
  for (int i = (0); i < (ret); i++) printf("%d %d\n", EA[i] + 1, EB[i] + 1);
  return 0;
}
