#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > a;
int n;
vector<pair<int, int> > res;
vector<pair<int, int> > links;
bool was[100500];
void dfs(const int v, const int p) {
  if (was[v]) return;
  was[v] = true;
  int cur_p = (int)links.size() + 1;
  if (-1 != p) links.push_back(make_pair(p, cur_p));
  for (int i = 0; i < (int)a[v].size(); i++) {
    int u = a[v][i];
    if (was[u]) continue;
    res.push_back(make_pair(v, u));
    dfs(u, cur_p);
  }
}
int main() {
  cin >> n;
  a.resize(n + 1);
  for (int f, t, i = 1; i < n; i++) {
    scanf("%d%d", &f, &t);
    a[f].push_back(t);
    a[t].push_back(f);
  }
  printf("%d\n", n - 1);
  dfs(1, -1);
  for (int i = 0; i < (int)res.size(); i++)
    printf("2 %d %d\n", res[i].first, res[i].second);
  for (int i = 0; i < (int)links.size(); i++)
    if (links[i].first != links[i].second)
      printf("%d %d\n", links[i].first, links[i].second);
  return 0;
}
