#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> G[1 << 20], nG[1 << 20];
vector<pair<int, int> > ans;
void dfs(int u, int p, int node = -1) {
  int idx = ((int)ans.size()) - 1, c = 0;
  for (int v : G[u])
    if (v != p) {
      if (node != -1)
        nG[node].push_back(((int)ans.size()));
      else if (!c)
        node = ((int)ans.size());
      ans.push_back(make_pair(u, v));
      c = 1;
      dfs(v, u, ((int)ans.size()) - 1);
    }
}
int main() {
  cin >> n;
  for (int i = 0; i < (n - 1); i++) {
    int a, b;
    cin >> a >> b;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  if (n == 1) {
    puts("1\n1 1");
    return 0;
  }
  dfs(1, 0);
  printf("%d\n", n - 1);
  for (auto p : ans) printf("2 %d %d\n", p.first, p.second);
  for (int i = 0; i < (n - 1); i++)
    for (int v : nG[i]) printf("%d %d\n", i + 1, v + 1);
  return 0;
}
