#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-7, PI = acos(-1);
const int inf = 0x3f3f3f3f;
const long long int linf = 0x3f3f3f3f3f3f3f3fLL;
int n;
vector<int> adj[100011];
int deg[100011];
vector<pair<int, int> > node, edge;
map<pair<int, int>, int> m;
void dfs(int u, int dad = -1, int pai = -1) {
  if (m.count(pair<int, int>(u, dad)) == 0)
    m[pair<int, int>(u, dad)] = m.size();
  int novo = m[pair<int, int>(u, dad)];
  if (dad != -1) {
    node.push_back(pair<int, int>(u, dad));
    edge.push_back(pair<int, int>(pai, novo));
  }
  for (int i = (0), __ = (adj[u].size()); i < __; i++) {
    int v = adj[u][i];
    if (v == dad) continue;
    dfs(v, u, novo);
  }
}
int main(int argc, char const* argv[]) {
  cin >> n;
  for (int i = (1), __ = (n); i < __; i++) {
    int u, v;
    cin >> u >> v;
    deg[u]++;
    deg[v]++;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  for (int i = (1), __ = (n); i <= __; i++)
    if (deg[i] == 1) {
      dfs(i);
      break;
    }
  cout << node.size() << '\n';
  for (int i = (0), __ = (node.size()); i < __; i++) {
    cout << 2 << ' ' << node[i].first << ' ' << node[i].second << '\n';
  }
  for (int i = (1), __ = (edge.size()); i < __; i++) {
    cout << edge[i].first - 1 << ' ' << edge[i].second - 1 << '\n';
  }
  return 0;
}
