#include <bits/stdc++.h>
using namespace std;
const int nmax = 100000 + 1;
int n;
vector<int> s[nmax];
vector<int> t[nmax];
int visited[nmax];
map<int, pair<int, int> > m;
int tsize = 1;
void dfs(int v, int linkto) {
  visited[v] = true;
  for (vector<int>::iterator it = s[v].begin(); it != s[v].end(); it++) {
    if (visited[*it]) continue;
    cerr << v << " -> " << *it << "\n";
    pair<int, int> edge = make_pair(v, *it);
    int w = tsize;
    m.insert(make_pair(w, edge));
    tsize++;
    if (linkto) {
      t[linkto].push_back(w);
    }
    linkto = w;
    dfs(*it, linkto);
  }
}
int main() {
  std::ios_base::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    s[a].push_back(b);
    s[b].push_back(a);
  }
  dfs(1, 0);
  cout << tsize - 1 << "\n";
  for (int i = 1; i < tsize; i++) {
    pair<int, int> p = m.find(i)->second;
    cout << "2 " << p.first << " " << p.second << "\n";
  }
  for (int i = 1; i < tsize; i++) {
    for (vector<int>::iterator it = t[i].begin(); it != t[i].end(); it++) {
      cout << i << " " << *it << "\n";
    }
  }
  return 0;
}
