#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
int n, cnt;
vector<int> e[N];
vector<pair<int, int> > ans;
void init() {
  scanf("%d", &n);
  for (int i = 1, x, y; i < n; ++i) {
    scanf("%d %d", &x, &y);
    e[x].push_back(y);
    e[y].push_back(x);
  }
}
void dfs(int x, int father, int last_idx) {
  int pre = last_idx;
  for (int i = 0; i < e[x].size(); ++i)
    if (e[x][i] != father) {
      printf("2 %d %d\n", x, e[x][i]);
      cnt++;
      if (pre != -1) ans.push_back(make_pair(pre, cnt));
      pre = cnt;
      dfs(e[x][i], x, cnt);
    }
}
void solve() {
  printf("%d\n", n - 1);
  cnt = 0;
  dfs(1, -1, -1);
  for (int i = 0; i < ans.size(); ++i)
    printf("%d %d\n", ans[i].first, ans[i].second);
}
int main() {
  init();
  solve();
  return 0;
}
