#include <bits/stdc++.h>
using namespace std;
const int MAX = 100010;
int nodes;
vector<pair<int, int> > T, E;
vector<int> G[MAX];
bool vis[MAX];
void dfs(int u, int id) {
  vis[u] = 1;
  for (int i = 0; i < G[u].size(); ++i) {
    int v = G[u][i];
    if (!vis[v]) {
      int node = ++nodes;
      T.push_back(make_pair(u, v));
      if (id == -1)
        id = node;
      else
        E.push_back(make_pair(node, id));
      dfs(v, node);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  int n, a, b;
  cin >> n;
  for (int i = 0; i < n - 1; ++i) {
    cin >> a >> b;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  memset(vis, 0, sizeof(vis));
  nodes = 0;
  dfs(1, -1);
  cout << n - 1 << endl;
  for (int i = 0; i < T.size(); ++i) {
    cout << "2 " << T[i].first << " " << T[i].second << "\n";
  }
  for (int i = 0; i < E.size(); ++i) {
    cout << E[i].first << " " << E[i].second << "\n";
  }
  return 0;
}
