#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > G;
vector<pair<int, int> > edge;
vector<pair<int, int> > Tedge;
void dfs(int u, int pare, int id_edge) {
  int k = int(G[u].size()) - 1;
  int id_pre = -1;
  for (int i = 0; i < int(G[u].size()); ++i)
    if (G[u][i] != pare) {
      edge.push_back(pair<int, int>(u, G[u][i]));
      if (id_pre == -1) {
        Tedge.push_back(pair<int, int>(id_edge, int(edge.size()) - 1));
        id_pre = int(edge.size()) - 1;
        dfs(G[u][i], u, id_pre);
      } else {
        Tedge.push_back(pair<int, int>(id_pre, int(edge.size()) - 1));
        id_pre = int(edge.size()) - 1;
        dfs(G[u][i], u, id_pre);
      }
    }
}
int main() {
  int n;
  cin >> n;
  G = vector<vector<int> >(n);
  for (int i = 0; i < int(n - 1); ++i) {
    int a, b;
    cin >> a >> b;
    --a;
    --b;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  dfs(0, -1, -1);
  cout << edge.size() << endl;
  for (int i = 0; i < int(edge.size()); ++i) {
    cout << 2 << " " << edge[i].first + 1 << " " << edge[i].second + 1 << endl;
  }
  for (int i = 0; i < int(Tedge.size()); ++i)
    if (Tedge[i].first != -1 and Tedge[i].second != -1) {
      cout << Tedge[i].first + 1 << " " << Tedge[i].second + 1 << endl;
    }
  cin >> n;
}
