#include <bits/stdc++.h>
using namespace std;
const int inf = 1 << 28;
vector<int> e[100010];
pair<int, int> ans[100010], edge[100010];
int kk = 0, fa[100010], eid = 0;
map<pair<int, int>, int> mp;
void dfs(int u, int pre) {
  for (int i = 0; i < (int)e[u].size(); i++) {
    int v = e[u][i];
    if (v == pre) continue;
    fa[v] = u;
    ans[kk++] = make_pair(u, v);
    mp[make_pair(u, v)] = kk - 1;
    if (u != 1) {
      int t = mp[make_pair(fa[u], u)];
      edge[eid++] = make_pair(t, kk - 1);
    } else if (i) {
      int t = mp[make_pair(u, e[u][0])];
      edge[eid++] = make_pair(t, kk - 1);
    }
    dfs(v, u);
  }
}
int main() {
  int n, x, y;
  scanf("%d", &n);
  for (int i = 0; i < n - 1; i++) {
    scanf("%d%d", &x, &y);
    e[x].push_back(y);
    e[y].push_back(x);
  }
  dfs(1, 1);
  printf("%d\n", kk);
  for (int i = 0; i < kk; i++) {
    printf("2 %d %d\n", ans[i].first, ans[i].second);
  }
  for (int i = 0; i < eid; i++) {
    printf("%d %d\n", edge[i].first + 1, edge[i].second + 1);
  }
}
