#include <bits/stdc++.h>
using namespace std;
const int N = 200001;
vector<int> g[N];
pair<int, int> ans[N];
vector<pair<int, int> > adj;
int leaf = 0;
void dfs(int v, int par) {
  ans[v] = make_pair(v, par);
  for (int i = 0; i < g[v].size(); i++)
    if (g[v][i] != par) {
      int head = v;
      int tail = g[v][i];
      if (head >= leaf) head--;
      if (tail >= leaf) tail--;
      adj.push_back(make_pair(head, tail));
      dfs(g[v][i], v);
    }
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    --u, --v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  for (int i = 1; i < n; i++)
    if (g[i].size() == 1) leaf = i;
  dfs(g[leaf].back(), leaf);
  printf("%d\n", n - 1);
  for (int i = 0; i < n; i++)
    if (i != leaf) printf("2 %d %d\n", ans[i].first + 1, ans[i].second + 1);
  for (int i = 0; i < adj.size(); i++)
    printf("%d %d\n", adj[i].first + 1, adj[i].second + 1);
}
