#include <bits/stdc++.h>
using namespace std;
int n, tot;
vector<pair<int, int> > e[100010];
vector<pair<int, int> > ps;
vector<pair<int, int> > es;
void dfs(int u, int p) {
  int fa;
  if (p == 0)
    fa = 0;
  else
    fa = ps[p - 1].first;
  int pre = 0;
  for (int i = 0, len = e[u].size(); i < len; ++i) {
    int v = e[u][i].first;
    if (v == fa) continue;
    e[u][i].second = ++tot;
    ps.push_back(make_pair(u, v));
    if (pre == 0) {
      if (fa != 0) es.push_back(make_pair(p, tot));
    } else
      es.push_back(make_pair(pre, tot));
    pre = tot;
    dfs(v, tot);
  }
}
int main() {
  int x, y;
  while (cin >> n) {
    for (int i = 1; i < n; ++i) {
      cin >> x >> y;
      e[x].push_back(make_pair(y, 0));
      e[y].push_back(make_pair(x, 0));
    }
    tot = 0;
    dfs(1, 0);
    cout << n - 1 << endl;
    for (int i = 0; i < ps.size(); ++i)
      cout << 2 << " " << ps[i].first << " " << ps[i].second << endl;
    for (int i = 0; i < es.size(); ++i)
      cout << es[i].first << " " << es[i].second << endl;
  }
  return 0;
}
