#include <bits/stdc++.h>
using namespace std;
vector<int> tr[101000];
vector<pair<int, int> > trs;
vector<pair<int, int> > ans;
int id;
void dfs(int now, int p, int pre) {
  for (int i = 0; i < tr[now].size(); i++) {
    int to = tr[now][i];
    if (to == p) continue;
    trs.push_back(make_pair(now, to));
    if (pre >= 0) ans.push_back(make_pair(id, pre));
    pre = id;
    id++;
    dfs(to, now, id - 1);
  }
}
int main() {
  int n;
  while (scanf("%d", &n) + 1) {
    trs.clear();
    ans.clear();
    for (int i = 0; i < n; i++) tr[i].clear();
    for (int i = 0; i < n - 1; i++) {
      int x, y;
      scanf("%d%d", &x, &y);
      x--, y--;
      tr[x].push_back(y);
      tr[y].push_back(x);
    }
    id = 0;
    dfs(0, -1, -1);
    printf("%d\n", trs.size());
    for (int i = 0; i < trs.size(); i++)
      printf("%d %d %d\n", 2, trs[i].first + 1, trs[i].second + 1);
    for (int i = 0; i < ans.size(); i++)
      printf("%d %d\n", ans[i].first + 1, ans[i].second + 1);
  }
  return 0;
}
