#include <bits/stdc++.h>
using namespace std;
const int maxn = (int)1e5;
int used[maxn];
int curid;
vector<pair<int, int> > edges;
vector<vector<int> > es;
void dfs(int v, int lastid) {
  used[v] = 1;
  for (int it = 0; it < ((int)(es[v]).size()); it++) {
    int u = es[v][it];
    if (used[u]) continue;
    curid++;
    printf("2 %d %d\n", v + 1, u + 1);
    if (lastid != -1) edges.push_back(make_pair(lastid, curid - 1));
    lastid = curid - 1;
    dfs(u, curid - 1);
  }
}
int main() {
  int n;
  while (scanf("%d", &n) >= 1) {
    es = vector<vector<int> >(n);
    for (int i = 0; i < n - 1; i++) {
      int s, t;
      scanf("%d%d", &s, &t);
      --s, --t;
      es[s].push_back(t), es[t].push_back(s);
    }
    curid = 0;
    memset(used, 0, sizeof(used));
    printf("%d\n", n - 1);
    edges.clear();
    dfs(0, -1);
    for (int i = 0; i < n - 2; i++)
      printf("%d %d\n", edges[i].first + 1, edges[i].second + 1);
  }
  return 0;
}
