#include <bits/stdc++.h>
using namespace std;
const int nmax = 1e5 + 5;
vector<int> adj[nmax];
int master[nmax];
int getmaster(int pos) {
  if (master[master[pos]] == master[pos]) return master[pos];
  return master[pos] = getmaster(master[pos]);
}
void unite(int a, int b) {
  int ma = getmaster(a), mb = getmaster(b);
  master[ma] = mb;
  cout << a << ' ' << b << '\n';
}
int main() {
  for (int i = 0; i < nmax; ++i) master[i] = i;
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  cout << n - 1 << '\n';
  vector<pair<int, int> > edges(n - 1);
  for (int i = 0; i < n - 1; ++i) {
    cin >> edges[i].first >> edges[i].second;
    cout << 2 << ' ' << edges[i].first << ' ' << edges[i].second << '\n';
    adj[edges[i].first].push_back(i + 1);
    adj[edges[i].second].push_back(i + 1);
  }
  for (int i = 1; i <= n; ++i) {
    int pos = adj[i][0];
    for (int j = 1; j < adj[i].size(); ++j) {
      if (getmaster(adj[i][j]) != getmaster(adj[i][0]))
        unite(adj[i][j], adj[i][0]);
    }
  }
}
